Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Core {
- #include <conio.h>
- #include <cstdlib>
- #include <ctime>
- #include <iostream>
- #include <string>
- /* SA-MP GDK: */
- #include <sampgdk/a_objects.hpp>
- #include <sampgdk/a_players.hpp>
- #include <sampgdk/a_samp.hpp>
- #include <sampgdk/a_vehicles.hpp>
- #include <sampgdk/core.hpp>
- #include <sampgdk/plugin.h>
- #pragma comment(lib, "sampgdk3.lib")
- class CPSD {
- public:
- int pSpeed[MAX_PLAYERS];
- int VelocityTimer[MAX_PLAYERS];
- int BindKey_(char * key);
- int IsVehiclePlaneOrHelicopter(int vehicleid);
- char str[MAX_PLAYERS][170];
- char Speed3DText[MAX_PLAYERS];
- char CarFireObject[MAX_PLAYERS];
- char Name[MAX_PLAYERS][MAX_PLAYER_NAME];
- float Pos[MAX_PLAYERS][3];
- float Health[MAX_PLAYERS];
- float xyz[MAX_PLAYERS][3];
- float GetSpeed(int playerid);
- float SetSpeed(int playerid);
- ~CPSD();
- inline bool PlayAudioStreamForPlayer(int playerid, const char * url);
- inline bool ApplyAnimation(int playerid, const char * animlib, const char * animname, float fDelta, bool loop, bool lockx, bool locky, bool freeze, int time);
- };
- CPSD Plugin_PSD;
- CPSD::~CPSD() {
- strcpy(* str, "");
- strcpy(Speed3DText, "");
- strcpy(CarFireObject, "");
- strcpy(* Name, "");
- * Health = 0.0;
- strcpy((char *)xyz, "");
- }
- int CPSD::BindKey_(char * key) {
- if(!strcmp("action", key)) return KEY_ACTION;
- else if(!strcmp("crouch", key)) return KEY_CROUCH;
- else if(!strcmp("fire", key)) return KEY_FIRE;
- else if(!strcmp("sprint", key)) return KEY_SPRINT;
- else if(!strcmp("attack", key)) return KEY_SECONDARY_ATTACK;
- else if(!strcmp("jump", key)) return KEY_JUMP;
- else if(!strcmp("lookr", key)) return KEY_LOOK_RIGHT;
- else if(!strcmp("lookl", key)) return KEY_LOOK_LEFT;
- else if(!strcmp("lookb", key)) return KEY_LOOK_BEHIND;
- else if(!strcmp("handbrake", key)) return KEY_HANDBRAKE;
- else if(!strcmp("submission", key)) return KEY_SUBMISSION;
- else if(!strcmp("walk", key)) return KEY_WALK;
- else if(!strcmp("aup", key)) return KEY_ANALOG_UP;
- else if(!strcmp("adown", key)) return KEY_ANALOG_DOWN;
- else if(!strcmp("aleft", key)) return KEY_ANALOG_LEFT;
- else if(!strcmp("aright", key)) return KEY_ANALOG_RIGHT;
- else if(!strcmp("yes", key)) return KEY_YES;
- else if(!strcmp("no", key)) return KEY_NO;
- else if(!strcmp("ctrlback", key)) return KEY_NO;
- else if(!strcmp("up", key)) return KEY_UP;
- else if(!strcmp("down", key)) return KEY_DOWN;
- else if(!strcmp("left", key)) return KEY_LEFT;
- else if(!strcmp("right", key)) return KEY_RIGHT;
- else return false;
- }
- int CPSD::IsVehiclePlaneOrHelicopter(int vehicleid) {
- switch(vehicleid) {
- case 417: case 425: case 447: case 460: case 464: case 465: case 469: case 476: case 487: case 488: case 497: case 501: case 511: case 512: case 513: case 519: case 520: case 539: case 553: case 548: case 563: case 577: case 592: case 593: return true; break;
- }
- return false;
- }
- float CPSD::GetSpeed(int playerid) {
- IsPlayerInAnyVehicle(playerid)? GetVehicleVelocity(GetPlayerVehicleID(playerid), &xyz[0][playerid], &xyz[1][playerid], &xyz[2][playerid]): GetPlayerVelocity(playerid, &xyz[0][playerid], &xyz[1][playerid], &xyz[2][playerid]);
- return 160 * sqrtf(powf(xyz[2][playerid], 2) + powf(xyz[1][playerid], 2) + powf(xyz[0][playerid], 2));
- }
- inline bool CPSD::PlayAudioStreamForPlayer(int playerid, const char * url) {
- float posX = 0.0;
- float posY = 0.0;
- float posZ = 0.0;
- float distance = 0.0;
- bool usepos = false;
- return ::sampgdk_PlayAudioStreamForPlayer(playerid, url, posX, posY, posZ, distance, usepos);
- }
- inline bool CPSD::ApplyAnimation(int playerid, const char * animlib, const char * animname, float fDelta, bool loop, bool lockx, bool locky, bool freeze, int time) {
- bool forcesync = false;
- return ::sampgdk_ApplyAnimation(playerid, animlib, animname, fDelta, loop, lockx, locky, freeze, time, forcesync);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement