Guest User

AntiBot

a guest
Jul 30th, 2012
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. // This is Anti flood+Ip limit edit by Audi_Quattrix
  2. // Original Creator Roperr All credits goes to him
  3. #define FILTERSCRIPT
  4.  
  5. #include <a_samp>
  6. #define GREEN 0x33AA33AA
  7. #define IP_LIMIT 3 // = Max connections from one single IP
  8. #define SAME_IP_CONNECT 3 // = The number of connects from the same IP before banning the flooder
  9. new Same_IP=0,Join_Stamp,ban_s[25],exceed=0;
  10. #define Time_Limit 3500 // = The time span between connects, adjust it to your own specifications
  11.  
  12. #if defined FILTERSCRIPT
  13. public OnFilterScriptInit()
  14. {
  15. print("\n--------------------------------------");
  16. print(" Anti flood+ ip limit loaded");
  17. print("--------------------------------------\n");
  18. return 1;
  19. }
  20. public OnPlayerConnect(playerid)
  21. {
  22. new ConnIP[16];
  23. GetPlayerIp(playerid,ConnIP,16);
  24. new compare_IP[16];
  25. new number_IP = 0;
  26. for(new i=0; i<MAX_PLAYERS; i++) {
  27. if(IsPlayerConnected(i)) {
  28. GetPlayerIp(i,compare_IP,16);
  29. if(!strcmp(compare_IP,ConnIP)) number_IP++;
  30. }
  31. }
  32. if((GetTickCount() - Join_Stamp) < Time_Limit)
  33. exceed=1;
  34. else
  35. exceed=0;
  36. if(strcmp(ban_s, ConnIP, false) == 0 && exceed == 1 )
  37. {
  38. Same_IP++;
  39. if(Same_IP > SAME_IP_CONNECT)
  40. {
  41. new string[128];
  42. format(string,sizeof(string),"Player %s Has been Banned [Reason: IP limit exceed/Bot attack]",GetPlayerNameEx(playerid));
  43. SendClientMessageToAll(GREEN,string);
  44. Ban(playerid);
  45. Same_IP=0;
  46. }
  47. }
  48. else
  49. {
  50. Same_IP=0;
  51. }
  52. if(number_IP > IP_LIMIT)
  53. Kick(playerid);
  54. GetStampIP(playerid);
  55. return 1;
  56. }
  57. stock GetPlayerIPEx(playerid)
  58. {
  59. new IP[15];
  60. GetPlayerIp(playerid, IP, 15);
  61. return IP;
  62. }
  63. stock GetStampIP(playerid){
  64. new S_IP[16];
  65. Join_Stamp=GetTickCount();
  66. GetPlayerIp(playerid,S_IP,16);
  67. format(ban_s, 16, "%s", S_IP);
  68. }
  69. stock GetPlayerNameEx(playerid)
  70. {
  71. new Name[MAX_PLAYER_NAME];
  72. GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
  73. return Name;
  74. }
  75. #endif
Advertisement
Add Comment
Please, Sign In to add comment