need help with ip adversting
#1

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
Reply
#2

any one?
Reply
#3

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
Reply
#4

thanks, now working
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)