if(PlayerInfo[playerid][pAdmin] < 1) Commands[playerid] ++;
if(Commands[playerid] >= 1)
{
KillTimer_H(CommandsTimer[playerid]);
CommandsTimer[playerid] = SetTimerEx("ResetCommands",4000,false,"i",playerid);
}
if(Commands[playerid] == 3) SendClientMessage(playerid, COLOR_LIGHTBLUE,"* Slow down with commands!");
if(Commands[playerid] == 5)
{
SendClientMessage(playerid,COLOR_LIGHTRED, "You are kicked!");
KillTimer_H(CommandsTimer[playerid]);
Kick(playerid);
}
public Timer()
{
foreach(Player, i)
{
If(Commands[i] > 0) Commands[i] = 0;
}
return 1;
}
new AntiSpam[MAX_PLAYERS];
if(gettime() < AntiSpam[playerid]) {
AntiSpam[playerid] = gettime() + 4;
}
else {
//here to send him to he is spaming
}
|
when 300 players enter any command, automatically will be activated 300 Timers, and that timers will slow server too much |
if(gettime() < AntiSpam[playerid]) {
AntiSpam[playerid] = gettime() + 4;
}
else {
//here to send him to he is spaming
}
new
AntiSpam[MAX_PLAYERS],
Commands[MAX_PLAYERS char]
;
if(PlayerInfo[playerid][pAdmin] < 1)
{
if((gettime() - AntiSpam[playerid]) < 4)
{
if(++Commands{playerid} > 4)
{
SendClientMessage(playerid,COLOR_LIGHTRED, "You are kicked!");
return !Kick(playerid);
}
if(Commands{playerid} > 2)
{
AntiSpam[playerid] = gettime();
return !SendClientMessage(playerid, COLOR_LIGHTBLUE,"* Slow down with commands!");
}
}
else
Commands{playerid} = 0;
AntiSpam[playerid] = gettime();
}