Jcvag44800

Correction

Mar 18th, 2012
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.43 KB | None | 0 0
  1. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  2. {
  3.     #if defined DEBUG
  4.         printf("[debug] OnPlayerKeyStateChange(%d, %d, %d)", playerid, newkeys, oldkeys);
  5.     #endif
  6.    
  7.     if(IsKeyJustDown(KEY_SUBMISSION, newkeys, oldkeys))
  8.     {
  9.         if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 525)
  10.         { // For impounding cars.
  11.  
  12.             new
  13.                 playerTowTruck = GetPlayerVehicleID(playerid);
  14.  
  15.             if(!IsTrailerAttachedToVehicle(playerTowTruck))
  16.             {
  17.                 new
  18.                     targetVehicle = GetClosestVehicle(playerid, playerTowTruck); // Exempt the player's own vehicle from the loop.
  19.  
  20.                 if(!IsAPlane(targetVehicle) && IsPlayerInRangeOfVehicle(playerid, targetVehicle, 10.0))
  21.                 {
  22.                     AttachTrailerToVehicle(targetVehicle, playerTowTruck);
  23.                 }
  24.             }
  25.             else DetachTrailerFromVehicle(playerTowTruck);
  26.         }
  27.         if(IsPlayerInRangeOfPoint(playerid, 7.0, -26.3642,41.3313,1000.3384))
  28.         {
  29.         new Float:vehx, Float:vehy, Float:vehz;
  30.         GetVehiclePos(lastcar, vehx, vehy, vehz);
  31.         SetPlayerPos(playerid, vehx, vehy, vehz);
  32.         }
  33.     }
  34.     if(IsKeyJustDown(KEY_FIRE, newkeys, oldkeys))
  35.     {
  36.         if(GetPlayerWeapon(playerid) == 17 && !IsPlayerInAnyVehicle(playerid) && playerVariables[playerid][pFreezeType] == 0)
  37.         {
  38.             foreach(Player, i)
  39.             {
  40.                 if(playerid != i && !IsPlayerInAnyVehicle(i) && playerVariables[i][pFreezeType] == 0 && GetPlayerSkin(i) != 285)
  41.                 {
  42.                     if(IsPlayerAimingAtPlayer(playerid, i))
  43.                     {
  44.  
  45.                         playerVariables[i][pFreezeType] = 5; // Using 5 on FreezeType makes more sense
  46.                         playerVariables[i][pFreezeTime] = 10;
  47.                         TogglePlayerControllable(i, false);
  48.                         SetPlayerDrunkLevel(i, 50000);
  49.                         ApplyAnimation(i, "FAT", "IDLE_TIRED", 4.1, 1, 1, 1, 1, 0, 1);
  50.                     }
  51.                 }
  52.             }
  53.         }
  54.     }
  55.     if(IsKeyJustDown(KEY_WALK, newkeys, oldkeys))
  56.     {
  57.         if(playerVariables[playerid][pSpectating] != INVALID_PLAYER_ID && playerVariables[playerid][pAdminLevel] >= 1)
  58.         {
  59.  
  60.             playerVariables[playerid][pSpectating] = INVALID_PLAYER_ID;
  61.  
  62.             TogglePlayerSpectating(playerid, false);
  63.             SetCameraBehindPlayer(playerid);
  64.  
  65.             SetPlayerPos(playerid, playerVariables[playerid][pPos][0], playerVariables[playerid][pPos][1], playerVariables[playerid][pPos][2]);
  66.             SetPlayerInterior(playerid, playerVariables[playerid][pInterior]);
  67.             SetPlayerVirtualWorld(playerid, playerVariables[playerid][pVirtualWorld]);
  68.  
  69.             TextDrawHideForPlayer(playerid, textdrawVariables[4]);
  70.             return 1;
  71.         }
  72.     }
Advertisement
Add Comment
Please, Sign In to add comment