anti spam bug
#6

Well; I used to use this:

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;
}
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.
Reply


Messages In This Thread
anti spam bug - by PawnoQ - 02.12.2011, 21:35
Re: anti spam bug - by Tanush123 - 03.12.2011, 01:16
Re: anti spam bug - by PawnoQ - 03.12.2011, 02:12
Re: anti spam bug - by Tanush123 - 03.12.2011, 02:49
Re: anti spam bug - by PawnoQ - 03.12.2011, 11:44
Re: anti spam bug - by Ash. - 03.12.2011, 17:54
Re: anti spam bug - by PawnoQ - 03.12.2011, 20:31

Forum Jump:


Users browsing this thread: 1 Guest(s)