Guest User

SAMP anti bot hack

a guest
Jul 6th, 2012
394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.26 KB | None | 0 0
  1. #define FILTERSCRIPT
  2. #include <a_samp>
  3. #include <gvar>
  4. #include <dudb>
  5. #define MAX_CONNECTIONS_FROM_IP     2 //azért 2 mert ha esetleg véletlen testvérek csatlakoznak és pont ugyanakkor akkor őket ne banolja
  6. #define TIME_BETWEEN_CONNECTIONS    500
  7. #pragma unused ret_memcpy
  8.  
  9.  
  10.  //IP cím számként tárolva
  11. public OnFilterScriptInit()
  12. {
  13.     print("BOT VÉDELEM AKTIVÁLVA");
  14.     return 1;
  15. }
  16. public OnFilterScriptExit()
  17. {
  18.     print("BOT VÉDELEM DEAKTIVÁLVA");
  19.     return 1;
  20. }
  21. public OnPlayerConnect(playerid)
  22. {
  23.     new hashIP,IP[32];
  24.     GetPlayerIp(playerid,IP,sizeof(IP));
  25.     hashIP = udbhash(IP);
  26.     SetGVarInt("IPconnections",GetGVarInt("IPconnections",hashIP)+1,hashIP);
  27.     if(GetGVarInt("IPconnections",hashIP) > MAX_CONNECTIONS_FROM_IP)
  28.     {
  29.         printf("BOT: connections from %s. IP has been banned.",IP);
  30.         BanEx(playerid, "BOT attack! version Devil");
  31.         SetTimerEx("ConnectionBack",TIME_BETWEEN_CONNECTIONS,0,"d",hashIP);
  32.         return 1;
  33.     }
  34.     else
  35.     {
  36.         SetTimerEx("ConnectionBack",TIME_BETWEEN_CONNECTIONS,0,"d",hashIP);
  37.     }
  38.     return 0;
  39. }
  40.  
  41.  
  42. forward ConnectionBack(hashid);
  43. public ConnectionBack(hashid)
  44. {
  45.     SetGVarInt("IPconnections",GetGVarInt("IPconnections",hashid)-1,hashid);
  46.     if(!GetGVarInt("IPconnections",hashid)) DeleteGVar("IPconnections",hashid);
  47. }
Add Comment
Please, Sign In to add comment