Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.98 KB | None | 0 0
  1. #include <a_samp>
  2. #include <foreach>
  3.  
  4. #define red 0xFF0000AA
  5. //#define TEST_MOVEMENT //uncomment this line to use debug, this will send a message to all players OnPlayerUpdate if they are "IN MOTION" or "STOPPED" (returns "STOPPED" in a vehicle)
  6.  
  7. new ammo1,
  8. ammo2,
  9. ammo3,
  10. ammo4,
  11. ammo5,
  12. ammo6,
  13. ammo7,
  14. ammo8,
  15. ammo9,
  16. ammo10,
  17. ammo11,
  18. weapon,
  19. total1A[MAX_PLAYERS],
  20. total2A[MAX_PLAYERS],
  21. total1B[MAX_PLAYERS],
  22. total2B[MAX_PLAYERS],
  23. total1C[MAX_PLAYERS],
  24. total2C[MAX_PLAYERS],
  25. hitsA[MAX_PLAYERS],
  26. hitsB[MAX_PLAYERS],
  27. hitsC[MAX_PLAYERS];
  28.  
  29. public OnPlayerConnect(playerid)
  30. {
  31. hitsA[playerid] = 0;
  32. hitsB[playerid] = 0;
  33. hitsC[playerid] = 0;
  34. total1A[playerid] = 0;
  35. total2A[playerid] = 0;
  36. total1B[playerid] = 0;
  37. total2B[playerid] = 0;
  38. total1C[playerid] = 0;
  39. total2C[playerid] = 0;
  40. return 1;
  41. }
  42.  
  43. public OnPlayerDisconnect(playerid, reason)
  44. {
  45. hitsA[playerid] = 0;
  46. hitsB[playerid] = 0;
  47. hitsC[playerid] = 0;
  48. total1A[playerid] = 0;
  49. total2A[playerid] = 0;
  50. total1B[playerid] = 0;
  51. total2B[playerid] = 0;
  52. total1C[playerid] = 0;
  53. total2C[playerid] = 0;
  54. return 1;
  55. }
  56.  
  57. public OnPlayerSpawn(playerid)
  58. {
  59. if(!IsPlayerConnected(playerid)) return 0;
  60. hitsA[playerid] = 0;
  61. hitsB[playerid] = 0;
  62. hitsC[playerid] = 0;
  63. total1A[playerid] = 0;
  64. total2A[playerid] = 0;
  65. total1B[playerid] = 0;
  66. total2B[playerid] = 0;
  67. total1C[playerid] = 0;
  68. total2C[playerid] = 0;
  69. return 1;
  70. }
  71.  
  72. public OnPlayerDeath(playerid, killerid, reason)
  73. {
  74. if(!IsPlayerConnected(playerid)) return 0;
  75. hitsA[playerid] = 0;
  76. hitsB[playerid] = 0;
  77. hitsC[playerid] = 0;
  78. total1A[playerid] = 0;
  79. total2A[playerid] = 0;
  80. total1B[playerid] = 0;
  81. total2B[playerid] = 0;
  82. total1C[playerid] = 0;
  83. total2C[playerid] = 0;
  84. return 1;
  85. }
  86.  
  87. public OnPlayerUpdate(playerid)
  88. {
  89. #if defined TEST_MOVEMENT
  90. IsPlayerMoving(playerid);
  91. #endif
  92. return 1;
  93. }
  94.  
  95. public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
  96. {
  97. if(!IsPlayerConnected(issuerid)) return 0;
  98. if(IsPlayerMoving(playerid) && hitsA[issuerid] == 0 && GetPlayerWeapon(issuerid) > 15 && GetPlayerWeapon(issuerid) < 28
  99. || IsPlayerMoving(playerid) && hitsA[issuerid] == 0 && GetPlayerWeapon(issuerid) > 32 && GetPlayerWeapon(issuerid) < 35) //handguns, shotguns, snipers
  100. {
  101. total1A[issuerid] = GetPlayerTotalAmmo(issuerid);
  102. hitsA[issuerid] ++;
  103. }
  104. if(IsPlayerMoving(playerid) && hitsA[issuerid] > 0 && hitsA[issuerid] < 12 && GetPlayerWeapon(issuerid) > 15 && GetPlayerWeapon(issuerid) < 28)
  105. {
  106. hitsA[issuerid] ++;
  107. }
  108. if(hitsA[issuerid] == 12)
  109. {
  110. total2A[issuerid] = GetPlayerTotalAmmo(issuerid);
  111. if(total1A[issuerid] - total2A[issuerid] < 15 && total1A[issuerid] - total2A[issuerid] >= 0)
  112. {
  113. new name[MAX_PLAYER_NAME], string[192];
  114. GetPlayerName(issuerid,name,sizeof(name));
  115. hitsA[issuerid] = 0;
  116. format(string, sizeof string, "{FF7D7D}[ATTENTION] {FF0000}%s {FF7D7D}id{FF0000}[%d] {FF7D7D}Needs to be spectated, {FF0000}Reason: {FF7D7D}POSSIBLE AIMBOT.", name, issuerid);
  117. foreach (new i : Player)
  118. {
  119. if(IsPlayerAdmin(i)) SendClientMessage(i,red,string); //will send to rcon admins unless you edit it for your admin script
  120. }
  121. }
  122. else
  123. {
  124. hitsA[issuerid] = 0;
  125. }
  126. }
  127. if(IsPlayerMoving(playerid) && hitsB[issuerid] == 0 && GetPlayerWeapon(issuerid) == 28
  128. || IsPlayerMoving(playerid) && hitsB[issuerid] == 0 && GetPlayerWeapon(issuerid) == 32) //tec 9 and uzi
  129. {
  130. total1B[issuerid] = GetPlayerTotalAmmo(issuerid);
  131. hitsB[issuerid] ++;
  132. }
  133. if(IsPlayerMoving(playerid) && hitsB[issuerid] > 0 && hitsB[issuerid] < 26 && GetPlayerWeapon(issuerid) == 28
  134. || IsPlayerMoving(playerid) && hitsB[issuerid] > 0 && hitsB[issuerid] < 26 && GetPlayerWeapon(issuerid) == 32)
  135. {
  136. hitsB[issuerid] ++;
  137. }
  138. if(hitsB[issuerid] == 26)
  139. {
  140. total2B[issuerid] = GetPlayerTotalAmmo(issuerid);
  141. if(total1B[issuerid] - total2B[issuerid] < 30 && total1B[issuerid] - total2B[issuerid] >= 0)
  142. {
  143. new name[MAX_PLAYER_NAME], string[192];
  144. GetPlayerName(issuerid,name,sizeof(name));
  145. hitsB[issuerid] = 0;
  146. format(string, sizeof string, "{FF7D7D}[ATTENTION] {FF0000}%s {FF7D7D}id{FF0000}[%d] {FF7D7D}Needs to be spectated, {FF0000}Reason: {FF7D7D}POSSIBLE AIMBOT.", name, issuerid);
  147. foreach (new i : Player)
  148. {
  149. if(IsPlayerAdmin(i)) SendClientMessage(i,red,string); //will send to rcon admins unless you edit it for your admin script
  150. }
  151. }
  152. else
  153. {
  154. hitsB[issuerid] = 0;
  155. }
  156. }
  157. if(IsPlayerMoving(playerid) && hitsC[issuerid] == 0 && GetPlayerWeapon(issuerid) > 28 && GetPlayerWeapon(issuerid) < 32) //MP5, AK47, M4
  158. {
  159. total1C[issuerid] = GetPlayerTotalAmmo(issuerid);
  160. hitsC[issuerid] ++;
  161. }
  162. if(IsPlayerMoving(playerid) && hitsC[issuerid] > 0 && hitsC[issuerid] < 20 && GetPlayerWeapon(issuerid) > 28 && GetPlayerWeapon(issuerid) < 32)
  163. {
  164. hitsC[issuerid] ++;
  165. }
  166. if(hitsC[issuerid] == 20)
  167. {
  168. total2C[issuerid] = GetPlayerTotalAmmo(issuerid);
  169. if(total1C[issuerid] - total2C[issuerid] < 23 && total1C[issuerid] - total2C[issuerid] >= 0)
  170. {
  171. new name[MAX_PLAYER_NAME], string[192];
  172. GetPlayerName(issuerid,name,sizeof(name));
  173. hitsC[issuerid] = 0;
  174. format(string, sizeof string, "{FF7D7D}[ATTENTION] {FF0000}%s {FF7D7D}id{FF0000}[%d] {FF7D7D}Needs to be spectated, {FF0000}Reason: {FF7D7D}POSSIBLE AIMBOT.", name, issuerid);
  175. foreach (new i : Player)
  176. {
  177. if(IsPlayerAdmin(i)) SendClientMessage(i,red,string); //will send to rcon admins unless you edit it for your admin script
  178. }
  179. }
  180. else
  181. {
  182. hitsC[issuerid] = 0;
  183. }
  184. }
  185. return 1;
  186. }
  187.  
  188. stock IsPlayerMoving(playerid)
  189. {
  190. new Float:Velocity[3];
  191. GetPlayerVelocity(playerid, Velocity[0], Velocity[1], Velocity[2]);
  192. if(Velocity[0] >= 0.02
  193. || Velocity[1] >= 0.02
  194. || Velocity[2] >= 0.02
  195. || Velocity[0] <= -0.02
  196. || Velocity[1] <= -0.02 //set at 0.02 and -0.02 will detect any on foot movement faster than standing on an escalator
  197. || Velocity[2] <= -0.02) //set at 0.07 and -0.07 will detect any on foot movement faster than walking or strafing (running)
  198. {
  199. #if defined TEST_MOVEMENT
  200. SendClientMessage(playerid, -1, "IN MOTION");
  201. #endif
  202. return true;
  203. }
  204. else
  205. {
  206. #if defined TEST_MOVEMENT
  207. SendClientMessage(playerid, red, "STOPPED");
  208. #endif
  209. return false;
  210. }
  211. }
  212.  
  213. stock GetPlayerTotalAmmo(playerid) //fist and melee weaps excluded
  214. {
  215. new totalammo;
  216. GetPlayerWeaponData(playerid, 2, weapon, ammo1);
  217. GetPlayerWeaponData(playerid, 3, weapon, ammo2);
  218. GetPlayerWeaponData(playerid, 4, weapon, ammo3);
  219. GetPlayerWeaponData(playerid, 5, weapon, ammo4);
  220. GetPlayerWeaponData(playerid, 6, weapon, ammo5);
  221. GetPlayerWeaponData(playerid, 7, weapon, ammo6);
  222. GetPlayerWeaponData(playerid, 8, weapon, ammo7);
  223. GetPlayerWeaponData(playerid, 9, weapon, ammo8);
  224. GetPlayerWeaponData(playerid, 11, weapon, ammo9);
  225. GetPlayerWeaponData(playerid, 12, weapon, ammo10);
  226. GetPlayerWeaponData(playerid, 13, weapon, ammo11);
  227. totalammo = ammo1+ammo2+ammo3+ammo4+ammo5+ammo6+ammo7+ammo8+ammo9+ammo10+ammo11;
  228. return totalammo;
  229. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement