Advertisement
rodrijose2009

[FILTERSCRIPT] Speed Hack

Jul 29th, 2015
1,077
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.36 KB | None | 0 0
  1. #include    <a_samp>
  2.  
  3. new SpeedBoost[MAX_PLAYERS];
  4.  
  5. stock IsKeyJustDown(key, newkeys, oldkeys)
  6. {
  7.     if((newkeys & key) && !(oldkeys & key))
  8.         return 1;
  9.  
  10.     return 0;
  11. }
  12.  
  13. stock IsKeyReleased(key, newkeys, oldkeys)
  14. {
  15.     if(!(newkeys & key) && (oldkeys & key))
  16.         return 1;
  17.  
  18.     return 0;
  19. }
  20.  
  21. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  22. {
  23.     if(IsKeyJustDown(KEY_FIRE, newkeys, oldkeys))
  24.     {
  25.         if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  26.         {
  27.             SpeedBoost[playerid] = 1;
  28.         }
  29.     }
  30.     if(IsKeyReleased(KEY_FIRE, newkeys, oldkeys))
  31.     {
  32.         if(SpeedBoost[playerid] > 0)
  33.         {
  34.             new Float:vx, Float:vy, Float:vz, vehicleid = GetPlayerVehicleID(playerid);
  35.             GetVehicleVelocity(vehicleid, vx, vy, vz);
  36.             if(floatabs(vx) < 3 && floatabs(vy) < 3 && floatabs(vz) < 3)
  37.             {
  38.                 SetVehicleVelocity(vehicleid, vx * 0.95, vy * 0.95, vz * 0.95);
  39.             }
  40.             SpeedBoost[playerid] = 0;
  41.         }
  42.     }
  43.     return 1;
  44. }
  45.  
  46. public OnPlayerUpdate(playerid)
  47. {
  48.     if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  49.     {
  50.         if(SpeedBoost[playerid] > 0)
  51.         {
  52.             new Float:vx, Float:vy, Float:vz, vehicleid = GetPlayerVehicleID(playerid);
  53.             GetVehicleVelocity(vehicleid, vx, vy, vz);
  54.             if(floatabs(vx) < 3 && floatabs(vy) < 3 && floatabs(vz) < 3)
  55.             {
  56.                 SetVehicleVelocity(vehicleid, vx * 1.05, vy * 1.05, vz * 1.05);
  57.             }
  58.         }
  59.     }
  60.     return 1;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement