SHARE
TWEET

[FS] FilterScript Anti DDOS Bots

Chip7 Aug 20th, 2012 1,145 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*VISITE NOSSO SITE: http://www.sampknd.com/
  2.   SAMP KND MELHOR BLOG DE SAMP DO BRASIL
  3. */
  4.  
  5. #include a_samp
  6.  
  7. #if !defined varGet
  8. #define varGet(%0)      getproperty(0,%0)
  9. #endif
  10.  
  11.  
  12.  
  13. #if !defined varSet
  14. #define varSet(%0,%1) setproperty(0, %0, %1)
  15. #endif
  16.  
  17. stock botGetIP[24];
  18.  
  19. #define IsPlayerBot(%0)\
  20.             GetPlayerPing(%0) == 65535 && (gettime() - varGet((GetPlayerIp(%0, botGetIP, sizeof botGetIP), botGetIP)) > 5)
  21.  
  22.  
  23. public OnPlayerConnect(playerid) {
  24.  
  25.     if(IsPlayerNPC(playerid)) return false;
  26.  
  27.     static
  28.         playerip[24]
  29.     ;
  30.  
  31.     GetPlayerIp(playerid, playerip, 24);
  32.  
  33.     if(gettime() - varGet(playerip) < 2) {
  34.  
  35.          
  36.         strcat(playerip, "di_S");
  37.  
  38.         if(gettime() - varGet(playerip) < 3) {
  39.             return false;
  40.         }
  41.          
  42.         printf("%d Entrou em menos de 2 segundos", playerid);
  43.  
  44.         GetPlayerIp(playerid, playerip, 20);
  45.  
  46.         varSet(playerip, gettime());
  47.  
  48.         strcat(playerip, "x");
  49.  
  50.         static timers ;
  51.         timers = varGet(playerip);
  52.  
  53.         varSet(playerip, 1+ timers);
  54.  
  55.         if(timers > 2) {
  56.  
  57.             playerip[strlen(playerip) - 2] = 0;
  58.  
  59.             printf("BOT: ID -> %d IP -> %s", playerid, playerip);
  60.             BanEx(playerid, "Bot Connect");
  61.         }
  62.     }
  63.     return varSet(playerip, gettime());
  64. }
  65.  
  66.  
  67. public OnPlayerDisconnect(playerid, reason) {
  68.     if(reason == 2) {
  69.  
  70.         static
  71.             playerip[20]
  72.         ;
  73.  
  74.  
  75.         GetPlayerIp(playerid, playerip, 20);
  76.         strcat(playerip, "di_S");
  77.  
  78.         varSet(playerip, gettime());
  79.     }
  80.     return false;
  81.  
  82. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top