Advertisement
Guest User

GAMELASTER's Anti Air Break

a guest
Mar 17th, 2012
991
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.43 KB | None | 0 0
  1. // This is a comment
  2. // uncomment the line below if you want to write a filterscript
  3. #define FILTERSCRIPT
  4.  
  5. #include <a_samp>
  6.  
  7. new Float:xo[MAX_PLAYERS],Float:yo[MAX_PLAYERS],Float:zo[MAX_PLAYERS];
  8. new timerantiairbrk[MAX_PLAYERS];
  9. forward antiairbrk(playerid);
  10.  
  11. AntiDeAMX()
  12. {
  13.    new a[][] =
  14.    {
  15.       "Unarmed (Fist)",
  16.       "Brass K"
  17.    };
  18.    #pragma unused a
  19. }
  20.  
  21. #if defined FILTERSCRIPT
  22.  
  23. public OnFilterScriptInit()
  24. {
  25.     AntiDeAMX();
  26.     print("\n-------------------------------------");
  27.     print("| Gamelasters Anti Air Brake Loaded |");
  28.     print("-------------------------------------\n");
  29.     return 1;
  30. }
  31.  
  32. public OnFilterScriptExit()
  33. {
  34.     return 1;
  35. }
  36.  
  37. #else
  38.  
  39. main()
  40. {
  41.     print("\n-------------------------------------");
  42.     print("| Gamelasters Anti Air Brake Loaded |");
  43.     print("-------------------------------------\n");
  44. }
  45.  
  46.  
  47. public OnGameModeInit()
  48. {
  49.     // Don't use these lines if it's a filterscript
  50.     SetGameModeText("Blank Script");
  51.     AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  52.     return 1;
  53. }
  54.  
  55. public OnGameModeExit()
  56. {
  57.     return 1;
  58. }
  59.  
  60. public OnPlayerRequestClass(playerid, classid)
  61. {
  62.     SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  63.     SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  64.     SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  65.     return 1;
  66. }
  67.  
  68. #endif
  69.  
  70. public OnPlayerConnect(playerid)
  71. {
  72.     return 1;
  73. }
  74.  
  75. public OnPlayerDisconnect(playerid, reason)
  76. {
  77.     KillTimer(timerantiairbrk[playerid]);
  78.     return 1;
  79. }
  80.  
  81. public OnPlayerSpawn(playerid)
  82. {
  83.     timerantiairbrk[playerid] = SetTimerEx("antiairbrk", 300, true, "i", playerid);
  84.     return 1;
  85. }
  86.  
  87. public OnPlayerDeath(playerid, killerid, reason)
  88. {
  89.     xo[playerid] = 0.0;
  90.     yo[playerid] = 0.0;
  91.     zo[playerid] = 0.0;
  92.     KillTimer(timerantiairbrk[playerid]);
  93.     return 1;
  94. }
  95.  
  96. public OnVehicleSpawn(vehicleid)
  97. {
  98.     return 1;
  99. }
  100.  
  101. public OnVehicleDeath(vehicleid, killerid)
  102. {
  103.     return 1;
  104. }
  105.  
  106. public OnPlayerText(playerid, text[])
  107. {
  108.     return 1;
  109. }
  110.  
  111. public OnPlayerCommandText(playerid, cmdtext[])
  112. {
  113.     if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  114.     {
  115.         // Do something here
  116.         return 1;
  117.     }
  118.     xo[playerid] = 0.0;
  119.     yo[playerid] = 0.0;
  120.     zo[playerid] = 0.0;
  121.     return 0;
  122. }
  123.  
  124. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  125. {
  126.     return 1;
  127. }
  128.  
  129. public OnPlayerExitVehicle(playerid, vehicleid)
  130. {
  131.     return 1;
  132. }
  133.  
  134. public OnPlayerStateChange(playerid, newstate, oldstate)
  135. {
  136.     return 1;
  137. }
  138.  
  139. public OnPlayerEnterCheckpoint(playerid)
  140. {
  141.     xo[playerid] = 0.0;
  142.     yo[playerid] = 0.0;
  143.     zo[playerid] = 0.0;
  144.     return 1;
  145. }
  146.  
  147. public OnPlayerLeaveCheckpoint(playerid)
  148. {
  149.     xo[playerid] = 0.0;
  150.     yo[playerid] = 0.0;
  151.     zo[playerid] = 0.0;
  152.     return 1;
  153. }
  154.  
  155. public OnPlayerEnterRaceCheckpoint(playerid)
  156. {
  157.     xo[playerid] = 0.0;
  158.     yo[playerid] = 0.0;
  159.     zo[playerid] = 0.0;
  160.     return 1;
  161. }
  162.  
  163. public OnPlayerLeaveRaceCheckpoint(playerid)
  164. {
  165.     xo[playerid] = 0.0;
  166.     yo[playerid] = 0.0;
  167.     zo[playerid] = 0.0;
  168.     return 1;
  169. }
  170.  
  171. public OnRconCommand(cmd[])
  172. {
  173.     return 1;
  174. }
  175.  
  176. public OnPlayerRequestSpawn(playerid)
  177. {
  178.     return 1;
  179. }
  180.  
  181. public OnObjectMoved(objectid)
  182. {
  183.     return 1;
  184. }
  185.  
  186. public OnPlayerObjectMoved(playerid, objectid)
  187. {
  188.     return 1;
  189. }
  190.  
  191. public OnPlayerPickUpPickup(playerid, pickupid)
  192. {
  193.     xo[playerid] = 0.0;
  194.     yo[playerid] = 0.0;
  195.     zo[playerid] = 0.0;
  196.     return 1;
  197. }
  198.  
  199. public OnVehicleMod(playerid, vehicleid, componentid)
  200. {
  201.     return 1;
  202. }
  203.  
  204. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  205. {
  206.     return 1;
  207. }
  208.  
  209. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  210. {
  211.     return 1;
  212. }
  213.  
  214. public OnPlayerSelectedMenuRow(playerid, row)
  215. {
  216.     return 1;
  217. }
  218.  
  219. public OnPlayerExitedMenu(playerid)
  220. {
  221.     return 1;
  222. }
  223.  
  224. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  225. {
  226.     return 1;
  227. }
  228.  
  229. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  230. {
  231.     return 1;
  232. }
  233.  
  234. public OnRconLoginAttempt(ip[], password[], success)
  235. {
  236.     return 1;
  237. }
  238.  
  239. public OnPlayerUpdate(playerid)
  240. {
  241.     return 1;
  242. }
  243.  
  244. public OnPlayerStreamIn(playerid, forplayerid)
  245. {
  246.     return 1;
  247. }
  248.  
  249. public OnPlayerStreamOut(playerid, forplayerid)
  250. {
  251.     return 1;
  252. }
  253.  
  254. public OnVehicleStreamIn(vehicleid, forplayerid)
  255. {
  256.     return 1;
  257. }
  258.  
  259. public OnVehicleStreamOut(vehicleid, forplayerid)
  260. {
  261.     return 1;
  262. }
  263.  
  264. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  265. {
  266.     xo[playerid] = 0.0;
  267.     yo[playerid] = 0.0;
  268.     zo[playerid] = 0.0;
  269.     return 1;
  270. }
  271.  
  272. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  273. {
  274.     xo[playerid] = 0.0;
  275.     yo[playerid] = 0.0;
  276.     zo[playerid] = 0.0;
  277.     return 1;
  278. }
  279.  
  280. stock IsPlayerSurfingOnVehicle(playerid)
  281. {
  282.     if(GetPlayerSurfingVehicleID(playerid) != INVALID_VEHICLE_ID)
  283.         return true;
  284.     return false;
  285. }
  286.  
  287. stock IsPlayerInAirPlane(playerid)
  288. {
  289.     new playerveh = GetPlayerVehicleID(playerid);
  290.     switch(GetVehicleModel(playerveh))
  291.     {
  292.         case
  293.             460,464,476,511,512,513,519,520,553,577,592,593,//flying vehicle models
  294.             417,425,447,465,469,487,488,497,501,548,563:
  295.             return true;
  296.     }
  297.     return false;
  298. }
  299.  
  300. stock Float:GetPlayerMoveCount(Float:oldd,Float:neww)
  301. {
  302.     new Float:ret;
  303.     if(oldd < neww)
  304.     {
  305.         ret = neww - oldd;//tag mismatch
  306.     }
  307.     else if(neww > oldd)
  308.     {
  309.         ret = oldd - neww;//tag mismatch
  310.     }
  311.     else if(neww == oldd)
  312.     {
  313.         ret = 0;
  314.     }
  315.     return ret;
  316. }
  317.  
  318. #define RED 0xFF0000FF
  319.  
  320. public antiairbrk(playerid)
  321. {
  322.     new Float:xt,Float:yt,Float:zt;
  323.     GetPlayerPos(playerid,xt,yt,zt);
  324.     if(!IsPlayerInAirPlane(playerid))
  325.     {
  326.         if(!IsPlayerSurfingOnVehicle(playerid))
  327.         {
  328.             if(xo[playerid] != 0.0 || yo[playerid] != 0.0 || zo[playerid] != 0.0)
  329.             {
  330.                 new Float:xs,Float:ys,Float:zs;
  331.                 xs = GetPlayerMoveCount(xo[playerid],xt);
  332.                 ys = GetPlayerMoveCount(yo[playerid],yt);
  333.                 zs = GetPlayerMoveCount(zo[playerid],zt);
  334.                 if(xs >= 16.5 || ys >= 16.5 || zs >= 16.5)
  335.                 {
  336.                     if(xs <= 50.0)
  337.                     {
  338.                         SendClientMessage(playerid,RED,"[GAIB] You Have Kicked for using AirBrake!!!");
  339.                         new name[21];
  340.                         GetPlayerName(playerid,name,sizeof(name));
  341.                         new out[125];
  342.                         format(out,sizeof(out),"[GAIB] Player %s has been kicked for using AirBrake!!!",name);
  343.                         SendClientMessageToAll(RED,out);
  344.                         Kick(playerid);
  345.                     }
  346.                 }
  347.             }
  348.         }
  349.     }
  350.     GetPlayerPos(playerid,xo[playerid],yo[playerid],zo[playerid]);
  351.     return 1;
  352. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement