Anti spam?
#1

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.
Reply
#2

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

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
Reply
#4

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

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
Reply
#7

Here you go.
Reply
#8

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.
Reply
#9

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?
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)