SA-MP Forums Archive
need help with ip adversting - 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: need help with ip adversting (/showthread.php?tid=351185)



need help with ip adversting - mineralo - 15.06.2012

ok, I tried to made anti IP adversting, how I check my code its fine but not working what's wrong?

pawn Код:
stock bool:CheckIPAdversting(string[])
{
    new numbers, lenght, dot, dot2;
    lenght = strlen(string);
    for(new i = 0; i < lenght; i++)
    {
        if(IsNumeric(string[i]))
        {
            numbers++;
        }
        if(strcmp(string[i],".",true) == 0)
        {
            dot++;
        }
        if(strcmp(string[i],":",true) == 0)
        {
            dot2++;
        }
    }
    if(numbers >= 5 && dot > 0 && dot2 >= 0) return true;
    else return false;
}
public OnPlayerText(playerid, text[])
{
    if(CheckIPAdversting(text))
    {
        format(string,sizeof(string),"( ! ) %s has been kicked by the server for: IP Advertising !",PlayerName(playerid));
        SendClientMessageToAll(COLOR_RED,string);
        Kick(playerid);
        return 0;
    }
return 0;
}
note: its not all codes from OnPlayerText


Re: need help with ip adversting - mineralo - 15.06.2012

any one?


Re: need help with ip adversting - JaKe Elite - 15.06.2012

pawn Код:
stock CheckIPAdvertising(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);
}
Credits to creator of fAdmin


Re: need help with ip adversting - mineralo - 15.06.2012

thanks, now working