Advertisement
Guest User

Untitled

a guest
Dec 17th, 2014
1,883
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.89 KB | None | 0 0
  1. /*-----------------------MohanedZzZ Anti-Cheats Filterscript-----------------------
  2.  
  3. -Filterscipt contains: Anti-RapidFire, Anti-Car Warp.
  4.  
  5. Weapon ID 28 - Micro SMG/Uzi
  6. Weapon ID 32 - Tec9
  7. Weapon ID 38 - Minigun
  8.  
  9. => Micro SMG/Uzi + Tec9 + Minigun = Disabled.
  10.  
  11. THE REASON:
  12. I have disabled the following weapons: Uzi - Tec9 - Minigun.
  13. Because they normally shoot fast. For example, uzi shoots 15 bullets in 2 seconds
  14. Since they don't work in Rapidfire too, so this is why they've been disabled.
  15. For the other weapons, they successfully work.
  16. When a player uses Rapidfire on the other weapons except those up ^^^ he/she
  17. will immediatly be (kicked).
  18. Do not forget to change 'Kick' function to your gamemode's.
  19. To see the code of the Rapidfire thing, go to OnPlayerWeaponShot.
  20. Skype MohanedZahran
  21. */
  22. //----------------------------------------Include(s)----------------------------
  23. #include <a_samp> //a_samp.inc
  24. new shotTime[MAX_PLAYERS];//Time bullets shot in a sec or two
  25. new shot[MAX_PLAYERS];
  26. new pVehicleMods[MAX_PLAYERS];
  27. new pVehicles[MAX_PLAYERS];
  28. //Booleans
  29. new bool: USE_ANTI_VEHICLE_HACK = true;
  30.  
  31. //Settings
  32. #define MAX_ENTER_VEHICLES 3
  33. //------------------------------------------------------------------------------
  34. public OnFilterScriptInit()
  35. {
  36. print("\n--------------------------------------");
  37. print("The Anti-Cheat system has been created by MoHaNeD14");
  38. print("--------------------------------------\n");
  39. return 1;
  40. }
  41. public OnFilterScriptExit()
  42. {
  43. return 1;
  44. }
  45. forward VehicleModReset(playerid);
  46. public VehicleModReset(playerid)
  47. {
  48. pVehicleMods[playerid] = 0;
  49. return 1;
  50. }
  51. stock GetAntiVehicleHackStatus()
  52. {
  53. new status[32];
  54. if(USE_ANTI_VEHICLE_HACK == true) { status = ""COL_NICEGREEN"ENABLED"COL_WHITE""; }
  55. else { status = ""COL_NICERED"DISABLED"COL_WHITE""; }
  56. return status;
  57. }
  58. public OnPlayerStateChange(playerid, newstate, oldstate)
  59. {
  60. // Vehicle hack detection
  61. if(USE_ANTI_VEHICLE_HACK == true)
  62. {
  63. if(IsPlayerInAnyVehicle(playerid) || newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
  64. {
  65. pVehicles[playerid]++;
  66. SetTimerEx("VehicleEnterReset", 3000, 0, "i", playerid);
  67. if(pVehicles[playerid] >= MAX_ENTER_VEHICLES && GetPlayerVirtualWorld(playerid) != 1718)
  68. {
  69. SendClientMessage(playerid, -1, "{FFFFFF}[ANTI-CHEAT]: {FF0000}[VEHICLE HACKS] - You have been kicked for vehicle hacks.");
  70. SetTimerEx("PlayerKick", 500, 0, "i", playerid);
  71. }
  72. }
  73. }
  74. return 1;
  75. }
  76. public OnPlayerConnect(playerid)
  77. {
  78. shotTime[playerid] =0;
  79. shot[playerid]=0;
  80. return 1;
  81. }
  82. forward OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ);
  83. public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
  84. {
  85. if(GetPlayerWeapon(playerid) == 38 || GetPlayerWeapon(playerid) == 28 || GetPlayerWeapon(playerid) == 32)
  86. {
  87. return 1;
  88. }
  89. else
  90. {
  91. if((gettime() - shotTime[playerid]) < 1)
  92. {
  93. shot[playerid]+=1;
  94. }
  95. else
  96. {
  97. shot[playerid]=0;
  98. }
  99. if(shot[playerid] > 10)
  100. {
  101. Kick(playerid);
  102. }
  103. shotTime[playerid] = gettime();
  104. }
  105. return 1;
  106. }
  107. forward PlayerKick(playerid);
  108. public PlayerKick(playerid)
  109. {
  110. Kick(playerid);
  111. return 1;
  112. }
  113. stock Kicked(playerid, time)
  114. {
  115. SetTimerEx("PlayerKick", time, false, "i", playerid);
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement