Advertisement
Guest User

ANTI-AIRBRK

a guest
Apr 14th, 2013
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.35 KB | None | 0 0
  1. #define FILTERSCRIPT
  2.  
  3. #include <a_samp>
  4.  
  5. new Float:xo[MAX_PLAYERS],Float:yo[MAX_PLAYERS],Float:zo[MAX_PLAYERS];
  6. new timerantiairbrk[MAX_PLAYERS];
  7. forward antiairbrk(playerid);
  8.  
  9. AntiDeAMX()
  10. {
  11. new a[][] =
  12. {
  13. "Unarmed (Fist)",
  14. "Brass K"
  15. };
  16. #pragma unused a
  17. }
  18.  
  19. public OnFilterScriptInit()
  20. {
  21. AntiDeAMX();
  22. print("\n-------------------------------------");
  23. print("| FS PAGAL-SN0P |");
  24. print("| 2013/04/14 |");
  25. print("| ANTI AIRBRK |");
  26. print("-------------------------------------\n");
  27. return 1;
  28. }
  29.  
  30. public OnFilterScriptExit()
  31. {
  32. return 1;
  33. }
  34.  
  35. public OnPlayerDisconnect(playerid, reason)
  36. {
  37. KillTimer(timerantiairbrk[playerid]);
  38. return 1;
  39. }
  40.  
  41. public OnPlayerSpawn(playerid)
  42. {
  43. timerantiairbrk[playerid] = SetTimerEx("antiairbrk", 300, true, "i", playerid);
  44. return 1;
  45. }
  46.  
  47. public OnPlayerDeath(playerid, killerid, reason)
  48. {
  49. xo[playerid] = 0.0;
  50. yo[playerid] = 0.0;
  51. zo[playerid] = 0.0;
  52. KillTimer(timerantiairbrk[playerid]);
  53. return 1;
  54. }
  55.  
  56. public OnPlayerCommandText(playerid, cmdtext[])
  57. {
  58. if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  59. {
  60. // Do something here
  61. return 1;
  62. }
  63. xo[playerid] = 0.0;
  64. yo[playerid] = 0.0;
  65. zo[playerid] = 0.0;
  66. return 0;
  67. }
  68.  
  69. public OnPlayerEnterCheckpoint(playerid)
  70. {
  71. xo[playerid] = 0.0;
  72. yo[playerid] = 0.0;
  73. zo[playerid] = 0.0;
  74. return 1;
  75. }
  76.  
  77. public OnPlayerLeaveCheckpoint(playerid)
  78. {
  79. xo[playerid] = 0.0;
  80. yo[playerid] = 0.0;
  81. zo[playerid] = 0.0;
  82. return 1;
  83. }
  84.  
  85. public OnPlayerEnterRaceCheckpoint(playerid)
  86. {
  87. xo[playerid] = 0.0;
  88. yo[playerid] = 0.0;
  89. zo[playerid] = 0.0;
  90. return 1;
  91. }
  92.  
  93. public OnPlayerLeaveRaceCheckpoint(playerid)
  94. {
  95. xo[playerid] = 0.0;
  96. yo[playerid] = 0.0;
  97. zo[playerid] = 0.0;
  98. return 1;
  99. }
  100.  
  101. public OnPlayerPickUpPickup(playerid, pickupid)
  102. {
  103. xo[playerid] = 0.0;
  104. yo[playerid] = 0.0;
  105. zo[playerid] = 0.0;
  106. return 1;
  107. }
  108.  
  109. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  110. {
  111. xo[playerid] = 0.0;
  112. yo[playerid] = 0.0;
  113. zo[playerid] = 0.0;
  114. return 1;
  115. }
  116.  
  117. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  118. {
  119. xo[playerid] = 0.0;
  120. yo[playerid] = 0.0;
  121. zo[playerid] = 0.0;
  122. return 1;
  123. }
  124.  
  125. stock IsPlayerInAirPlane(vehicleid)
  126. {
  127. switch(GetVehicleModel(vehicleid))
  128. {
  129. case
  130. 460,464,476,511,512,513,519,520,553,577,592,593,//flying vehicle models
  131. 417,425,447,465,469,487,488,497,501,548,563:
  132. return true;
  133. }
  134. return false;
  135. }
  136.  
  137. stock Float:GetPlayerMoveCount(Float:oldd,Float:neww)
  138. {
  139. new Float:ret;
  140. if(oldd < neww)
  141. {
  142. ret = neww - oldd;//tag mismatch
  143. }
  144. else if(neww > oldd)
  145. {
  146. ret = oldd - neww;//tag mismatch
  147. }
  148. else if(neww == oldd)
  149. {
  150. ret = 0;
  151. }
  152. return ret;
  153. }
  154.  
  155. #define RED 0xFF0000FF
  156.  
  157. public antiairbrk(playerid)
  158. {
  159. new Float:xt,Float:yt,Float:zt;
  160. GetPlayerPos(playerid,xt,yt,zt);
  161. if(!IsPlayerInAirPlane(playerid))
  162. {
  163. if(xo[playerid] != 0.0 || yo[playerid] != 0.0 || zo[playerid] != 0.0)
  164. {
  165. new Float:xs,Float:ys,Float:zs;
  166. xs = GetPlayerMoveCount(xo[playerid],xt);
  167. ys = GetPlayerMoveCount(yo[playerid],yt);
  168. zs = GetPlayerMoveCount(zo[playerid],zt);
  169. if(xs >= 16.5 || ys >= 16.5 || zs >= 16.5)
  170. {
  171. if(xs <= 50.0)
  172. {
  173. SendClientMessage(playerid,RED,"[APSAUGA]Buvau išmestas už naudojamasi AIR-BRK");
  174. new name[255];
  175. GetPlayerName(playerid,name,sizeof(name));
  176. new out[800];
  177. format(out,sizeof(out),"[APSAUGA] Žaidėjas %s buvo iškikintas naudojantis air-brk",name);
  178. SendClientMessageToAll(RED,out);
  179. Kick(playerid);
  180. }
  181. }
  182. }
  183. }
  184. GetPlayerPos(playerid,xo[playerid],yo[playerid],zo[playerid]);
  185. return 1;
  186. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement