Guest User

Untitled

a guest
Feb 21st, 2017
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. #include <a_samp>
  2. #define IP_LIMIT 1 // = Max connections from one single IP
  3. #define SAME_IP_CONNECT 2 // = The number of connects from the same IP before banning the flooder
  4. new Same_IP=0,Join_Stamp,ban_s[25],exceed=0;
  5. #define Time_Limit 3500 // = The time span between connects, adjust it to your own specifications
  6.  
  7. public OnPlayerConnect(playerid)
  8. {
  9. new ConnIP[16];
  10. GetPlayerIp(playerid,ConnIP,16);
  11. new compare_IP[16];
  12. new number_IP = 0;
  13. for(new i=0; i<MAX_PLAYERS; i++) {
  14. if(IsPlayerConnected(i)) {
  15. GetPlayerIp(i,compare_IP,16);
  16. if(!strcmp(compare_IP,ConnIP)) number_IP++;
  17. }
  18. }
  19. if((GetTickCount() - Join_Stamp) < Time_Limit)
  20. exceed=1;
  21. else
  22. exceed=0;
  23. if(strcmp(ban_s, ConnIP, false) == 0 && exceed == 1 )
  24. {
  25. Same_IP++;
  26. if(Same_IP > SAME_IP_CONNECT)
  27. {
  28. Ban(playerid);
  29. Same_IP=0;
  30. }
  31. }
  32. else
  33. {
  34. Same_IP=0;
  35. }
  36. if(number_IP > IP_LIMIT)
  37. Kick(playerid);
  38. GetStampIP(playerid);
  39. return 1;
  40.  
  41. }
  42. stock GetStampIP(playerid){
  43. new S_IP[16];
  44. Join_Stamp=GetTickCount();
  45. GetPlayerIp(playerid,S_IP,16);
  46. format(ban_s, 16, "%s", S_IP);
  47. }
Add Comment
Please, Sign In to add comment