Advertisement
Shiny_

Untitled

Sep 23rd, 2013
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.31 KB | None | 0 0
  1. // TIMER:
  2. static void SAMPGDK_CALL Set_CameraPos(int, void *) {
  3.         for(int playerid = NULL; playerid <= MAX_PLAYERS; playerid++) {
  4.             SetPlayerInterior(playerid, NULL);
  5.             SetPlayerFacingAngle(playerid, 90.0f);
  6.             SetPlayerPos(playerid, -1399.0179f, 2640.7385f, 55.6875f);
  7.             SetPlayerCameraPos(playerid, -1410.462402f, 2640.7385f, 55.6875f);
  8.             SetPlayerCameraLookAt(playerid, -1410.462402f, 2640.7385f, 55.6875f, CAMERA_CUT);
  9.             ApplyAnimation(playerid, "RAPPING", "RAP_B_Loop", 4.0, 1, 0, 0, 0, 0);
  10.         }
  11.     }
  12.  
  13. // Public functions:
  14.     PUBLIC OnGameModeInit() {
  15.         for(int i = 0; i <= 299; i++) {
  16.             AddPlayerClass(i, -1399.0179f, 2640.7385f, 55.6875f, 0.0, 0, 0, 0, 0, 0, 0);
  17.         }
  18.         return true;
  19.     }
  20.  
  21.     PUBLIC OnPlayerConnect(int playerid) {
  22.         PlayAudioStreamForPlayer(playerid, "http://alldev.eu/mp3/april_showers.mp3");
  23.        
  24.         InterpolateCameraPos(playerid, -1635.208984f, 2274.272460f, 101.468925f, -1428.462402f, 2642.478271f, 66.434036f, INTERPOLATIONTIME, CAMERA_CUT);
  25.         InterpolateCameraLookAt(playerid, -1633.167846f, 2278.822753f, 101.109863f, -1423.579956f, 2642.294677f, 65.371879f, INTERPOLATIONTIME, CAMERA_CUT);
  26.         Set_CameraPos_Timer[playerid] = SetTimer(Set_CameraPos, INTERPOLATIONTIME, false);
  27.         return true;
  28.     }
  29.  
  30.     PUBLIC OnPlayerUpdate(int playerid) {
  31.         GetPlayerName(playerid, Name[playerid], sizeof(Name[playerid]));
  32.         GetVehicleHealth(GetPlayerVehicleID(playerid), &Health[playerid]);
  33.         IsPlayerInAnyVehicle(playerid)? sprintf(str[playerid], "\n[%s]\n%0.1f km/h\n%0.1f/1000.0", &gVehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid)) - 400], GetSpeed(playerid), Health[playerid]), UpdatePlayer3DTextLabelText(playerid, Speed3DText[playerid], -1, str[playerid]): false;
  34.         return true;
  35.     }
  36.    
  37.     PUBLIC OnPlayerStateChange(int playerid, int newstate, int oldstate) {
  38.         newstate == PLAYER_STATE_DRIVER? Speed3DText[playerid] = CreatePlayer3DTextLabel(playerid, "Infernus\n666 KM/H", -1, 0, 0, 0, 15.0, INVALID_PLAYER_ID, GetPlayerVehicleID(playerid), 1): false;
  39.         oldstate == PLAYER_STATE_DRIVER? DeletePlayer3DTextLabel(playerid, Speed3DText[playerid]): false;
  40.         return true;
  41.     }
  42.    
  43.     PUBLIC OnPlayerKeyStateChange(int playerid, int newkeys, int oldkeys) {
  44.         if((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
  45.             if(IsValidObject(CarFireObject[playerid]) == 0) {
  46.                 CarFireObject[playerid] = CreateObject(18694, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 500.0f);
  47.                 AttachObjectToVehicle(CarFireObject[playerid], GetPlayerVehicleID(playerid), 0.0f, -2.3f, 1.2f, 180.0f, 0.0f, 0.0f);
  48.             }
  49.             AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
  50.             !IsPlayerInAnyVehicle(playerid)? RemoveVehicleComponent(GetPlayerVehicleID(playerid), 1010), DestroyObject(CarFireObject[playerid]): false;
  51.             return true;
  52.         }
  53.        
  54.         else if((oldkeys & KEY_FIRE) && !(newkeys & KEY_FIRE) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
  55.             DestroyObject(CarFireObject[playerid]);
  56.             RemoveVehicleComponent(GetPlayerVehicleID(playerid), 1010);
  57.             return true;
  58.         }
  59.    
  60.         BindKey("submission") {
  61.             IsPlayerInAnyVehicle(playerid)?
  62.                     RepairVehicle(GetPlayerVehicleID(playerid)),
  63.                     GameTextForPlayer(playerid,"~y~Pojazd naprawiony!", 2000, 5),
  64.                     PlayerPlaySound(playerid, 1133, 0.0f, 0.0f, 0.0f):
  65.             false;
  66.         }
  67.         return true;
  68.     }
  69.  
  70.     PUBLIC OnPlayerRequestClass(int playerid, int classid) {
  71.         switch(GetPVarInt(playerid, "Dance")) {
  72.             case 0: ApplyAnimation(playerid, "DANCING", "dnce_M_a", 4.1f, 1, 1, 1, 1, 1, 1); break;
  73.             case 1: ApplyAnimation(playerid, "DANCING", "dnce_M_b", 4.1f, 1, 1, 1, 1, 1, 1); break;
  74.             case 2: ApplyAnimation(playerid, "DANCING", "dnce_M_c", 4.1f, 1, 1, 1, 1, 1, 1); break;
  75.             case 3: ApplyAnimation(playerid, "DANCING", "dnce_M_d", 4.1f, 1, 1, 1, 1, 1, 1); break;
  76.             case 4: ApplyAnimation(playerid, "DANCING", "dnce_M_e", 4.1f, 1, 1, 1, 1, 1, 1); break;
  77.         }
  78.         SetPVarInt(playerid, "Dance", GetPVarInt(playerid, "Dance") < 4? GetPVarInt(playerid, "Dance") + 1: 0);
  79.         return true;
  80.     }
  81.  
  82.     PUBLIC OnPlayerSpawn(int playerid) {
  83.         KillTimer(Set_CameraPos_Timer[playerid]);
  84.         SetCameraBehindPlayer(playerid);
  85.         StopAudioStreamForPlayer(playerid);
  86.         SetPlayerFacingAngle(playerid, 90.0f);
  87.         SetPlayerPos(playerid, -1399.0179f, 2640.7385f, 55.6875f);
  88.         SetPlayerWorldBounds(playerid, 20000.0000, -20000.0000, 20000.0000, -20000.0000);
  89.         return true;
  90.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement