SA-MP Forums Archive
Anti spam? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Anti spam? (/showthread.php?tid=320789)



Anti spam? - Zhoom - 24.02.2012

hello sa-mp scripters.
is there any way to make an anti spam system which counts, if a player say a same words 4 times, it will mute that player. i've already searched for this, but none of them counts like this one.
any ideas? thanks.


Re: Anti spam? - Kaperstone - 24.02.2012

here:
https://sampforum.blast.hk/showthread.php?tid=301568
or
https://sampforum.blast.hk/showthread.php?tid=245358
your choice


Re: Anti spam? - Zhoom - 24.02.2012

well i dont want those.
i want a system like if a player says a same word 4 times, it will mute that player although he didn't spamming/flooding quickly


Re: Anti spam? - dice7 - 24.02.2012

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!");
        }
    }
}



Re: Anti spam? - Zhoom - 25.02.2012

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..


Re: Anti spam? - chrism11 - 25.02.2012

i just use strfind

and if the text has 3 of the same text in a row, it mutes for 60 seconds

it accounts for accedental "t"'s and stuff


Re: Anti spam? - Luka P. - 25.02.2012

Here you go.


Re: Anti spam? - Zhoom - 25.02.2012

y u no read my post? :<
let me explain again. i want an anti-spam system that counts if a player say 3 same text in a row, it will mute him.


Re: Anti spam? - BenBiddulph - 25.02.2012

It's not a matter of reading your post, it's a matter of it being possible. Alot of the anti-spam links above work fine, just use one of them?


Re: Anti spam? - Zhoom - 25.02.2012

the problem is, we can easily avoid this antispam by spamming words per 1 second.
for example, i type laksdjaslkdj, then after 1 second, i type the same word again.. and so on.. .-.