Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define FILTERSCRIPT
- #include <a_samp>
- #include <gvar>
- #include <dudb>
- #define MAX_CONNECTIONS_FROM_IP 2 //azért 2 mert ha esetleg véletlen testvérek csatlakoznak és pont ugyanakkor akkor őket ne banolja
- #define TIME_BETWEEN_CONNECTIONS 500
- #pragma unused ret_memcpy
- //IP cím számként tárolva
- public OnFilterScriptInit()
- {
- print("BOT VÉDELEM AKTIVÁLVA");
- return 1;
- }
- public OnFilterScriptExit()
- {
- print("BOT VÉDELEM DEAKTIVÁLVA");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- new hashIP,IP[32];
- GetPlayerIp(playerid,IP,sizeof(IP));
- hashIP = udbhash(IP);
- SetGVarInt("IPconnections",GetGVarInt("IPconnections",hashIP)+1,hashIP);
- if(GetGVarInt("IPconnections",hashIP) > MAX_CONNECTIONS_FROM_IP)
- {
- printf("BOT: connections from %s. IP has been banned.",IP);
- BanEx(playerid, "BOT attack! version Devil");
- SetTimerEx("ConnectionBack",TIME_BETWEEN_CONNECTIONS,0,"d",hashIP);
- return 1;
- }
- else
- {
- SetTimerEx("ConnectionBack",TIME_BETWEEN_CONNECTIONS,0,"d",hashIP);
- }
- return 0;
- }
- forward ConnectionBack(hashid);
- public ConnectionBack(hashid)
- {
- SetGVarInt("IPconnections",GetGVarInt("IPconnections",hashid)-1,hashid);
- if(!GetGVarInt("IPconnections",hashid)) DeleteGVar("IPconnections",hashid);
- }
Add Comment
Please, Sign In to add comment