Anti advertisment via PM
#1

It's easy to make anti advertisement on public chat but how does one make it so that when you type an IP by /pm, it'll automatically kicks/bans the player. This is what i got ;/


Quote:

public OnPlayerText(playerid, text[])

if(strfind(text, "", true) != -1)
{
SendClientMessage(playerid, COLOR_WHITE, "{FFDC2E}[Advertisement] {FFFFFF} Anti advertisement detected.");
Ban(playerid);
Kick(playerid);
return 0;
}
Reply
#2

Have you got a PM command already made?
Reply
#3

Just add the same check in the PM command, and if it requires a different action, do it there.
Reply
#4

Do it in a function, something like this:

pawn Код:
stock IsSpam(const string[])
{
    new count, i, URL[][] = {"www.", ".com", ".ar", ".gob", ".tk", ".mx"/*...*/};
   
    for(i = 0; i < strlen(string); i++)
    {
        if('0' <= string[i] <= '9')
        {
            if(++count < 5) continue;
            else return 1;
        }
    }
   
    for(i = 0; i < sizeof(URL); i++)
    {
        if(strfind(string, URL[i], true) != -1) return 1;
    }
    return 0;
}
And so

pawn Код:
if(IsSpam(string)) return Ban(playerid);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)