Guest User

Anti-Cheat tips - By iFiras

a guest
Dec 3rd, 2013
542
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.37 KB | None | 0 0
  1. //-----------------------Firas's Anti-Cheats Filterscript-----------------------
  2. //Filterscipt contains: Anti-weapon hack, Anti-car spam cheat, Anti-High ping (Max ping: 1000,you may change it), Anti-Spawning a jetpack
  3. //----------------------------------------Include(s)----------------------------
  4. #include <a_samp> //a_samp.inc
  5. //------------------------------Forwards (two forwards)-------------------------
  6. forward AntiHack();
  7. forward HasIllegalWeapon(playerid);
  8. //------------------------------------------------------------------------------
  9. #define MAX_PING 1000 //Max ping is 1000, you may change it
  10. //------------------------------------------------------------------------------
  11. public OnFilterScriptInit()
  12. {
  13. print("\n--------------------------------------");
  14. print("Anti-cheats filterscript by iFiras. 2013");
  15. print("--------------------------------------\n");
  16. return 1;
  17. }
  18. public OnFilterScriptExit()
  19. {
  20. return 1;
  21. }
  22. public OnGameModeInit()
  23. {
  24. SetTimer("AntiHack",1000,true);
  25. return 1;
  26. }
  27. public OnGameModeExit()
  28. {
  29. return 1;
  30. }
  31. public OnPlayerStateChange(playerid, newstate, oldstate)
  32. {
  33. if(newstate == PLAYER_STATE_DRIVER)
  34. {
  35. if((GetTickCount()-GetPVarInt(playerid, "CarTime")) < 1000) // Enters vehicle as driver faster than 1 once
  36. {
  37. SetPVarInt(playerid, "CarSpam", GetPVarInt(playerid, "CarSpam")+1);
  38. if(GetPVarInt(playerid, "CarSpam") >= 5) //Allows 5 seconds leeway to compensate for glitching, then kicks
  39. {
  40. new pname[24];
  41. new string[128];
  42. GetPlayerName(playerid,pname,24);
  43. format(string,sizeof(string),"[ANTI-CHEAT] %s(%d) has been kicked for car spamming hack.",pname,playerid);
  44. SendClientMessageToAll(-1,string);
  45. printf(string);
  46. Kick(playerid);
  47. }
  48. }
  49. SetPVarInt(playerid, "CarTime", GetTickCount());
  50. }
  51. return 1;
  52. }
  53. public AntiHack()
  54. {
  55. for(new i=0; i<MAX_PLAYERS; i++)
  56. {
  57. if(IsPlayerConnected(i))
  58. {
  59. new pname[24];
  60. new string[128];
  61. GetPlayerName(i,pname,sizeof(pname));
  62. new pSpecialAction = GetPlayerSpecialAction(i);
  63. if (pSpecialAction == SPECIAL_ACTION_USEJETPACK) //Anti-jetpack-hack
  64. {
  65. format(string,sizeof(string),"[ANTI-CHEAT] %s(%d) has been banned for spawning a jetpack.",pname,i);
  66. SendClientMessageToAll(-1,string);
  67. BanEx(i,"Spawning a jetpack");
  68. return 1;
  69. }
  70. if(HasIllegalWeapon(i)) //If player spawned an illegal weapon = BAN
  71. {
  72. format(string,sizeof(string),"[ANTI-CHEAT] {FFFFFF}%s(%d) has been banned for spawning an illegal weapon.",pname,i);
  73. SendClientMessageToAll(-1,string);
  74. BanEx(i,"Spawning an illegal weapon");
  75. return 1;
  76. }
  77. //Anti high ping
  78. if(GetPlayerPing(i) >= MAX_PING)
  79. {
  80. format(string,sizeof(string),"[ANTI-CHEAT] {FFFFFF}%s(%d) has been kicked for excessive ping [%d/%d].",pname,i,GetPlayerPing(i),MAX_PING);
  81. SendClientMessageToAll(-1,string);
  82. Kick(i);
  83. return 1;
  84. }
  85. }
  86. }
  87. return 1;
  88. }
  89. public HasIllegalWeapon(playerid)
  90. {
  91. if(GetPlayerWeapon(playerid) == 16 || GetPlayerWeapon(playerid) == 17 || GetPlayerWeapon(playerid) == 35 ||
  92. GetPlayerWeapon(playerid) == 36 || GetPlayerWeapon(playerid) == 37 || GetPlayerWeapon(playerid) == 38 ||
  93. GetPlayerWeapon(playerid) == 39 || GetPlayerWeapon(playerid) == 40 || GetPlayerWeapon(playerid) == 18)
  94. {
  95. return 1;
  96. }
  97. return 0;
  98. }
Advertisement
Add Comment
Please, Sign In to add comment