Anti spam?
#5

Quote:
Originally Posted by dice7
Посмотреть сообщение
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!");
        }
    }
}

that doesnt work.. it only work if someone flooding/spamming quickly..
Reply


Messages In This Thread
Anti spam? - by Zhoom - 24.02.2012, 16:10
Re: Anti spam? - by Kaperstone - 24.02.2012, 16:29
Re: Anti spam? - by Zhoom - 24.02.2012, 16:59
Re: Anti spam? - by dice7 - 24.02.2012, 18:06
Re: Anti spam? - by Zhoom - 25.02.2012, 12:43
Re: Anti spam? - by chrism11 - 25.02.2012, 12:51
Re: Anti spam? - by Luka P. - 25.02.2012, 12:54
Re: Anti spam? - by Zhoom - 25.02.2012, 13:07
Re: Anti spam? - by BenBiddulph - 25.02.2012, 13:33
Re: Anti spam? - by Zhoom - 25.02.2012, 13:58

Forum Jump:


Users browsing this thread: 2 Guest(s)