24.05.2011, 14:47
Quote:
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 Код:
|
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.*.*