Anti advertisment via PM - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Server (
https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (
https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: Anti advertisment via PM (
/showthread.php?tid=622229)
Anti advertisment via PM -
xSkin - 20.11.2016
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;
}
|
Re: Anti advertisment via PM -
Luis- - 22.11.2016
Have you got a PM command already made?
Re: Anti advertisment via PM -
SickAttack - 22.11.2016
Just add the same check in the PM command, and if it requires a different action, do it there.
Respuesta: Anti advertisment via PM -
Swedky - 23.11.2016
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);