25.08.2017, 15:08
I've heard those floods aren't getting any player ID, so i've made the code below, any chance on succes with it?
And this is only supposed to work if the bot doesn't receive a player ID, meaning a flooding bot!
It is supposed to store the IP when a connection is made, 5 seconds later it checks if the IP matches the IP of a player, if not, it blocks the IP for 24 hours. It compiled without errors.
Does this even have any chance to work?
And this is only supposed to work if the bot doesn't receive a player ID, meaning a flooding bot!
It is supposed to store the IP when a connection is made, 5 seconds later it checks if the IP matches the IP of a player, if not, it blocks the IP for 24 hours. It compiled without errors.
Does this even have any chance to work?
pawn Код:
#define MAX_STORED 1000
enum CheckInfo
{
IP[16],
IsUsed = 0
};
new cInfo[MAX_STORED][CheckInfo];
new playerIP[16];
public OnIncomingConnection(playerid, ip_address[], port)
{
new id = GetEmptyStoreID();
format(cInfo[id][IP], 16, "%s", ip_address);
cInfo[id][IsUsed] = 1;
SetTimerEx("CheckForID", 5000, false, "d", id);
return 1;
}
forward CheckForID(checkID);
public CheckForID(checkID)
{
new Pool = GetPlayerPoolSize();
for(new i = 0; i <= Pool; i++)
{
GetPlayerIp(i, playerIP, 16);
if(strcmp(playerIP, cInfo[checkID][IP]))
{
BlockIpAddress(playerIP, 8640000); // block the IP for 24 hours
cInfo[checkID][IsUsed] = 0;
}
}
}
stock GetEmptyStoreID()
{
for(new i = 1; i < MAX_STORED; i++)
{
if(cInfo[i][IsUsed] == 1) continue ;
return i;
}
return -1;
}