Advertisement
DetonaSampOficial

[anti-ip]

Apr 1st, 2016
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.54 KB | None | 0 0
  1. #include a_samp
  2.  
  3. #if !defined varGet
  4. #define varGet(%0)      getproperty(0,%0)
  5. #endif
  6.  
  7. // http://forum.sa-mp.com/showthread.php?p=1925909
  8.  
  9.  
  10. #if !defined varSet
  11. #define varSet(%0,%1) setproperty(0, %0, %1)
  12. #endif
  13.  
  14. stock botGetIP[24];
  15.  
  16. #define IsPlayerBot(%0)\
  17.             GetPlayerPing(%0) == 65535 && (gettime() - varGet((GetPlayerIp(%0, botGetIP, sizeof botGetIP), botGetIP)) > 5)
  18.  
  19.  
  20. public OnPlayerConnect(playerid) {
  21.  
  22.     if(IsPlayerNPC(playerid)) return false;
  23.  
  24.     static
  25.         playerip[24]
  26.     ;
  27.  
  28.     GetPlayerIp(playerid, playerip, 24);
  29.  
  30.     if(gettime() - varGet(playerip) < 2) {
  31.  
  32.  
  33.         strcat(playerip, "di_S");
  34.  
  35.         if(gettime() - varGet(playerip) < 3) {
  36.             return false;
  37.         }
  38.  
  39.         printf("%d Entrou em menos de 2 segundos", playerid);
  40.  
  41.         GetPlayerIp(playerid, playerip, 20);
  42.  
  43.         varSet(playerip, gettime());
  44.  
  45.         strcat(playerip, "x");
  46.  
  47.         static timers ;
  48.         timers = varGet(playerip);
  49.  
  50.         varSet(playerip, 1+ timers);
  51.  
  52.         if(timers > 2) {
  53.  
  54.             playerip[strlen(playerip) - 2] = 0;
  55.  
  56.             printf("BOT: ID -> %d IP -> %s", playerid, playerip);
  57.             BanEx(playerid, "Bot Connect");
  58.         }
  59.     }
  60.     return varSet(playerip, gettime());
  61. }
  62.  
  63.  
  64. public OnPlayerDisconnect(playerid, reason) {
  65.     if(reason == 2) {
  66.  
  67.         static
  68.             playerip[20]
  69.         ;
  70.  
  71.  
  72.         GetPlayerIp(playerid, playerip, 20);
  73.         strcat(playerip, "di_S");
  74.  
  75.         varSet(playerip, gettime());
  76.     }
  77.     return false;
  78.  
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement