Advertisement
Guest User

AntiAirBreak

a guest
Nov 17th, 2020
16
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. aB_Func: aB_Timer(){
  2.  
  3. new
  4. aB_SurfVehicle,
  5. aB_SurfObject,
  6. aB_State,
  7. Float:aB_AtualPos[3],
  8. Float:aB_Range
  9. ;
  10.  
  11. foreach(new aB_Player : Player){
  12.  
  13.  
  14. GetPlayerPos(aB_Player, aB_AtualPos[0], aB_AtualPos[1], aB_AtualPos[2]);
  15.  
  16. aB_SurfVehicle = GetPlayerSurfingVehicleID(aB_Player);
  17. aB_SurfObject = GetPlayerSurfingObjectID(aB_Player);
  18. aB_State = GetPlayerState(aB_Player);
  19. aB_Range = AIRBREAK_DISTANCIA;
  20.  
  21. if(aB_State == PLAYER_STATE_DRIVER || GetPlayerPing(aB_Player) > 500){
  22.  
  23. aB_Range += 45.0;
  24. }
  25.  
  26. if(aB_SurfVehicle == INVALID_VEHICLE_ID && aB_SurfObject == INVALID_OBJECT_ID && (aB_State == 1 || aB_State == 2)){
  27.  
  28. if(!IsPlayerInRangeOfPoint(aB_Player, aB_Range, aB_Info[aB_Player][aB_Pos][0], aB_Info[aB_Player][aB_Pos][1], aB_Info[aB_Player][aB_Pos][2])
  29. && !IsPlayerInRangeOfPoint(aB_Player, 10.0, aB_Info[aB_Player][aB_SetPos][0], aB_Info[aB_Player][aB_SetPos][1], aB_Info[aB_Player][aB_SetPos][2])){
  30.  
  31. if(gettime() > aB_Info[aB_Player][aB_Aguardo])CallLocalFunction("OnPlayerAirBreak", "i", aB_Player);
  32. }
  33. }
  34.  
  35. aB_SavePos(aB_Player, aB_AtualPos[0], aB_AtualPos[1], aB_AtualPos[2]);
  36. }
  37. }
  38.  
  39. stock aB_SavePos(playerid, Float:x, Float:y, Float:z){
  40.  
  41. aB_Info[playerid][aB_Pos][0] = x;
  42. aB_Info[playerid][aB_Pos][1] = y;
  43. aB_Info[playerid][aB_Pos][2] = z;
  44.  
  45. aB_Info[playerid][aB_Aguardo] = gettime() + 2;
  46. }
  47.  
  48. aB_Func: aB_SetPlayerPos(playerid, Float:x, Float:y, Float:z){
  49.  
  50. aB_SavePos(playerid, x, y, z);
  51.  
  52. aB_Info[playerid][aB_SetPos][0] = x;
  53. aB_Info[playerid][aB_SetPos][1] = y;
  54. aB_Info[playerid][aB_SetPos][2] = z;
  55.  
  56. return SetPlayerPos(playerid, x, y, z);
  57. }
  58.  
  59. aB_Func: aB_PutPlayerInVehicle(playerid, vehicleid, seatid){
  60.  
  61. static
  62. Float:aB_VehiclePos[3]
  63. ;
  64.  
  65. GetVehiclePos(vehicleid, aB_VehiclePos[0], aB_VehiclePos[1], aB_VehiclePos[2]);
  66.  
  67. aB_SavePos(playerid, aB_VehiclePos[0], aB_VehiclePos[1], aB_VehiclePos[2]);
  68.  
  69. aB_Info[playerid][aB_SetPos][0] = aB_VehiclePos[0];
  70. aB_Info[playerid][aB_SetPos][1] = aB_VehiclePos[1];
  71. aB_Info[playerid][aB_SetPos][2] = aB_VehiclePos[2];
  72.  
  73. return PutPlayerInVehicle(playerid, vehicleid, seatid);
  74. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement