rendered paste bodynew gFloodCount[MAX_PLAYERS];
public OnGameModeInit()
{
SetTimer("FloodProtection",3000, 1);
}
public OnPlayerText(playerid, text[])
{
new count;
count = gFloodCount[playerid];
count = count+1;
gFloodCount[playerid] = count;
return 1;
}
public FloodProtection()
{
for(new i=0; i<MAX_PLAYERS; i++) {
if(gFloodCount[i] >= 3) {
new string[256], name[20];
GetPlayerName(i, name, sizeof(name));
format(string,sizeof(string),"%s has been kicked (Flood/Spam Protection)",name);
SendClientMessageToAll(COLOR_DARKRED, string);
Kick(i);
}
gFloodCount[i] = 0;
}
return 1;
}