Searching advertising
#1

Hey guys, I need some help because some "k3wl guys" are advertising on my server and I want to stop it now.

So:
I don't know how to check if the string contains domain endings(".com", ".info", etc).
For example, in this string:
pawn Код:
www.sa-mp.com
I want to check if the string contains ".com", or if the string contains "sa" or "mp".

Thank you!
Reply
#2

Possibly something like this, put under OnPlayerText;

pawn Код:
static const TLD[][] = { ".com", ".net", ".org", ".info", ".ru", ".ro", ".pl", ".tk", ".cc" /* add more as you see fit */ };

for(new i; i < sizeof(TLD); i++)
{
    if(strfind(text, TLD[i], true) != -1)
    {
        if(strfind(text, "www.yourownwebsite.com", true) != -1) break; // Filter out your own website
       
        SendClientMessage(playerid, COLOR_RED, "No Advertising!");
        Kick(playerid);
        return 0;
    }
   
}
Reply
#3

Thanks a lot!
Reply
#4

Quote:
Originally Posted by Vince
Посмотреть сообщение
Possibly something like this, put under OnPlayerText;

pawn Код:
static const TLD[][] = { ".com", ".net", ".org", ".info", ".ru", ".ro", ".pl", ".tk", ".cc" /* add more as you see fit */ };

for(new i; i < sizeof(TLD); i++)
{
    if(strfind(text, TLD[i], true) != -1)
    {
        if(strfind(text, "www.yourownwebsite.com", true) != -1) break; // Filter out your own website
       
        SendClientMessage(playerid, COLOR_RED, "No Advertising!");
        Kick(playerid);
        return 0;
    }
   
}
This doesn't work fully, when I type "Hey www.advertisment.com is much better then www.yourownwebsite.com"
This doesn't get blocked
Reply
#5

Quote:
Originally Posted by Vince
Посмотреть сообщение
Possibly something like this, put under OnPlayerText;

pawn Код:
static const TLD[][] = { ".com", ".net", ".org", ".info", ".ru", ".ro", ".pl", ".tk", ".cc" /* add more as you see fit */ };

for(new i; i < sizeof(TLD); i++)
{
    if(strfind(text, TLD[i], true) != -1)
    {
        if(strfind(text, "www.yourownwebsite.com", true) != -1) break; // Filter out your own website
       
        SendClientMessage(playerid, COLOR_RED, "No Advertising!");
        Kick(playerid);
        return 0;
    }
   
}
tested the script, it works ingame but its still echoing at my irc channel although it doesnt show the text ingame.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)