Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This is Anti flood+Ip limit edit by Audi_Quattrix
- // Original Creator Roperr All credits goes to him
- #define FILTERSCRIPT
- #include <a_samp>
- #define GREEN 0x33AA33AA
- #define IP_LIMIT 3 // = Max connections from one single IP
- #define SAME_IP_CONNECT 3 // = The number of connects from the same IP before banning the flooder
- new Same_IP=0,Join_Stamp,ban_s[25],exceed=0;
- #define Time_Limit 3500 // = The time span between connects, adjust it to your own specifications
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Anti flood+ ip limit loaded");
- print("--------------------------------------\n");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- new ConnIP[16];
- GetPlayerIp(playerid,ConnIP,16);
- new compare_IP[16];
- new number_IP = 0;
- for(new i=0; i<MAX_PLAYERS; i++) {
- if(IsPlayerConnected(i)) {
- GetPlayerIp(i,compare_IP,16);
- if(!strcmp(compare_IP,ConnIP)) number_IP++;
- }
- }
- if((GetTickCount() - Join_Stamp) < Time_Limit)
- exceed=1;
- else
- exceed=0;
- if(strcmp(ban_s, ConnIP, false) == 0 && exceed == 1 )
- {
- Same_IP++;
- if(Same_IP > SAME_IP_CONNECT)
- {
- new string[128];
- format(string,sizeof(string),"Player %s Has been Banned [Reason: IP limit exceed/Bot attack]",GetPlayerNameEx(playerid));
- SendClientMessageToAll(GREEN,string);
- Ban(playerid);
- Same_IP=0;
- }
- }
- else
- {
- Same_IP=0;
- }
- if(number_IP > IP_LIMIT)
- Kick(playerid);
- GetStampIP(playerid);
- return 1;
- }
- stock GetPlayerIPEx(playerid)
- {
- new IP[15];
- GetPlayerIp(playerid, IP, 15);
- return IP;
- }
- stock GetStampIP(playerid){
- new S_IP[16];
- Join_Stamp=GetTickCount();
- GetPlayerIp(playerid,S_IP,16);
- format(ban_s, 16, "%s", S_IP);
- }
- stock GetPlayerNameEx(playerid)
- {
- new Name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
- return Name;
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment