24.02.2012, 18:06
Not tested
pawn Код:
#include <a_samp>
new spamCount[MAX_PLAYERS];
new previousWord[MAX_PLAYERS][128];
public OnGameModeInit()
{
SetTimer("antiSpam", 5000, 1);
}
public OnPlayerConnect(playerid)
{
spamCount[playerid] = 0;
return 1;
}
public OnPlayerText(playerid, text[])
{
if (strcmp(previousWord[playerid], text) == 0)
{
spamCount[playerid] ++;
}
strins(previousWord[playerid], text, 0, 128);
if (spamCount[playerid] >= 4)
{
SendClientMessage(playerid, 0xFF0000FF, "You have been muted. Stop spamming!");
spamCount[playerid] += 3; //to keep him muted for awhile
return 0; //do not send the text
}
spamCount[playerid] ++;
return 1;
}
forward antiSpam();
public antiSpam()
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
spamCount[i] --;
if (spamCount[i] == 4)
{
SendClientMessage(i, 0xFF0000FF, "You have been unmuted!");
}
}
}