advertise
#1

how can i replace the ip with *'s?

im use Ryder`s code
pawn Code:
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);
}
if someone advertise i want it ro return like this:

somename: Everyone come to my server!! the ip is ***.***.*.*:****
Reply
#2

NVM.
Reply
#3

pawn Code:
stock AdvertisementCheck(string[])
{
    if(string[0])
    {
        if(!strfind(string,"www.",false) || !strfind(string,"http://",false)
        || !strfind(string,".com",false) || !strfind(string,".net",false)
        || !strfind(string,".de",false)  || !strfind(string,".org",false))
        return true;
       
        new c=1,idx,tmp[32],ip[4];
        for(new i=0;i<strlen(string);i++)
        if(string[i]==' ')
        c++;

        for(new i=0;i<c;i++)
        {
            idx=0;
            tmp = L_strtok(string,idx);
            idx=0;
            tmp = L_strtok(tmp,idx,':');
            ip=SplitIP(tmp);
            if(ip[0] && ip[1] && ip[2] && ip[3]) // We have found and IP :o
            return true;
        }
    }
    return false;
}
Credits to Luxorion since these is from lux admin
I suggest you to change strtok to sscanf
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)