SA-MP Forums Archive
Help - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help (/showthread.php?tid=80290)



Help - BigNewBie - 03.06.2009

How to make no advertising? so, you can't write server IP's!




Re: Help - Think - 03.06.2009

Quote:
Originally Posted by BigNewBie
How to make no advertising? so, you can't write server IP's!

pawn Код:
IpCheck(playerid, text[])
{
    new var, pos, oldpos;
    oldpos = strfind(text, ".", true);
    if(strval(text[oldpos - 1]) == 0) return 1;

    while((pos = strfind(text, ".", true, pos + 1)) != -1 && pos - oldpos <= 4)
    {
        var++;

        if(strval(text[pos + 1]) == 0 || text[pos + 1] == ' ') return 1;
        oldpos = pos;

        if(var == 3 && (pos = strfind(text, ":", true, pos + 1)) != -1)
        {
            if(strval(text[pos + 1]) == 0 || text[pos + 1] == ' ') return 1;
            BanEx(playerid, "Advertising");
            return 0;
        }
    }
    return 1;
}
Not created by me but its the thing you need, found it someday somewhere on the forums.

use it like this:

pawn Код:
public OnPlayerText(playerid, text)
{
   IpCheck(playerid, text);
   return 1;
}

public OnPlayerPrivMsg(playerid, senderid, text)
{
    IpCheck(senderid, text);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext)
{
    IpCheck(playerid, cmdtext);
    return 0;
}
Should edit to be exact.