PDA

View Full Version : Searching advertising


CONTROLA
03/03/2012, 10:00 AM
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:
www.sa-mp.com

I want to check if the string contains ".com", or if the string contains "sa" or "mp".

Thank you!

Vince
03/03/2012, 10:14 AM
Possibly something like this, put under OnPlayerText;


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;
}

}

CONTROLA
03/03/2012, 10:21 AM
Thanks a lot!

R0FLC0PTER
03/03/2012, 10:40 AM
Possibly something like this, put under OnPlayerText;


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

Zhoom
03/03/2012, 10:48 AM
Possibly something like this, put under OnPlayerText;


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.