03.12.2011, 17:54
Well; I used to use this:
When a player sends a message, it increments a variable called "MessageCount". If their "MessageCount" variable is greater than ten, it mutes them. It then waits 60 seconds (6 timer 'ticks') and un-mutes them.
Like I told you in PM, I'm not in a position to re-create that efficiently, therefore they may be a few issues.
pawn Код:
new bool:Muted[MAX_PLAYERS], MessageCount[MAX_PLAYERS];
forward Spam_Timer();
public OnGameModeInit()
{
SetTimer("SpamTimer", 10000, true);
//Rest of OnGameModeInit
}
public OnPlayerText(playerid, text[])
{
if(Muted[playerid]) return SendClientMessage(playerid, COLOUR_RED, "You are muted."), 0;
MessageCount[playerid]++;
//Rest of OnPlayerText
}
public SpamTimer()
{
for(new playerid; playerid < GetMaxPlayers(); playerid++)
{
if(Muted[playerid])
{
MessageCount[playerid]++;
if(MessageCount[playerid] == 6)
{
Muted[playerid] = false;
MessageCount[playerid] = 0;
SendClientMessage(playerid, COLOUR_RED, "You have been unmuted.");
}
}
if(MessageCount[playerid] > 10)
{
SendClientMessage(playerid, COLOUR_RED, "You have been muted for spamming the chat.");
Muted[playerid] = true;
}
MessageCount[playerid] = 0;
}
return 1;
}
Like I told you in PM, I'm not in a position to re-create that efficiently, therefore they may be a few issues.

