Searching advertising - 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: Searching advertising (
/showthread.php?tid=322691)
Searching advertising -
CONTROLA - 03.03.2012
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:
I want to check if the string contains ".com", or if the string contains "sa" or "mp".
Thank you!
Re: Searching advertising -
Vince - 03.03.2012
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;
}
}
Re: Searching advertising -
CONTROLA - 03.03.2012
Thanks a lot!
Re: Searching advertising -
R0FLC0PTER - 03.03.2012
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
Re: Searching advertising -
Zhoom - 03.03.2012
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.