SA-MP Forums Archive
[HELP] IP Detecter - 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: [HELP] IP Detecter (/showthread.php?tid=534236)



[HELP] IP Detecter - Tisot - 28.08.2014

hey i need an IP detector if some one try to spam and server IP on chat then change the ip like this **.***.**.****
please tell me the script


Re: [HELP] IP Detecter - Thogy - 28.08.2014

pawn Код:
public OnPlayerText(playerid, text[])
{
        if(stringContainsIP(text))
        {
        Kick(playerid);
        }
    return 0;
}
stock stringContainsIP(string[])
{
    new
        dotCount
    ;
    for(new i; string[i] != EOS; ++i)
    {
        if(('0' <= string[i] <= '9') || string[i] == '.' || string[i] == ':')
        {
            if((string[i] == '.') && (string[i + 1] != '.') && ('0' <= string[i - 1] <= '9'))
            {
                ++dotCount;
            }
            continue;
        }
    }
    return (dotCount > 2);
}