Split IP
#1

Hello All,

Today, I want to make a ban system with time and range ban.

I want to separate the numbers to compare in the banlist with numbers or * for each part of the IP.
Example: ip=199.188.177.166
==> ip1="199"; ip2="188"; ip3="177"; ip4="166";

Код:
new jip[16], cip[4][3];

GetPlayerIp(playerid, jip, sizeof(jip));
split(jip, cip, '.');
But, with this script, I have:
ip1="199"; ip2="188177166"; ip3="177166"; ip4="166";

it's strange, I don't understand the function split
Quote:

split(const strsrc[], strdest[][], delimiter)
{
new i, li;
new aNum;
new len;
while(i <= strlen(strsrc)){
if(strsrc[i]==delimiter || i==strlen(strsrc)){
len = strmid(strdest[aNum], strsrc, li, i, 12;
strdest[aNum][len] = 0;
li = i+1;
aNum++;
}
i++;
}
return 1;
}

What's the solution ?

thank you in advance (sorry for my bad english)
Reply


Messages In This Thread
Split IP - by Mr.Momo - 24.11.2011, 17:10
Re: Split IP - by AndreT - 24.11.2011, 17:17
Re : Split IP - by Mr.Momo - 24.11.2011, 17:38
Re: Re : Split IP - by Steven82 - 24.11.2011, 17:40

Forum Jump:


Users browsing this thread: 1 Guest(s)