Detect "range ips" with GetPlayerIP.
#4

Quote:
Originally Posted by Biesmen
Посмотреть сообщение
I didn't mean that code will work, I meant something similair to that.
So, the only way to find the first few digits of an IP would be:
pawn Код:
new pip[5];
GetPlayerIp(playerid, pip, sizeof(pip));
if(!strcmp(pip, "127.0"))
A single strcmp will not work IMO.
Don't think of using the "length" parameter in strcmp, or getting the first few digits of the IP, because the length of IPs are different.
If you try to get first 5 characters of the IP then it may get something like "11.12","111.2",
while their actual IP is "11.123.200.1","111.213.65.30",etc..

To check it you have to split the values into four and check them:
pawn Код:
new IP[4],IPString[16];
GetPlayerIp(playerid,IPString,sizeof(IPString));
sscanf(IPString,"p<.>a<i>[4]",IP);
if(IP[0] == 127 && IP[1] == 0) Ban(playerid);//Player's IP matches 127.0.*.*
Reply


Messages In This Thread
Detect "range ips" with GetPlayerIP. - by Biesmen - 24.05.2011, 14:20
Re: Detect "range ips" with GetPlayerIP. - by gamer931215 - 24.05.2011, 14:27
Re: Detect "range ips" with GetPlayerIP. - by Biesmen - 24.05.2011, 14:31
Re: Detect "range ips" with GetPlayerIP. - by leong124 - 24.05.2011, 14:47
Re: Detect "range ips" with GetPlayerIP. - by Biesmen - 24.05.2011, 14:52

Forum Jump:


Users browsing this thread: 4 Guest(s)