26.12.2010, 15:24
forgot to add the whole code, so with the code below it works (because it search for 127.0.0.1 and my ip is also 127.0.0.1:
but when I change that it searchs for 127.0.*.* while my ip is 127.0.0.1, it doesn't work:
pawn Код:
public OnPlayerConnect(playerid)
{
new idx;
new IP[4][256];
new str[128];
GetPlayerIp(playerid,str,sizeof(str));
IP[0] = strtok(str, idx, '.');
IP[1] = strtok(str, idx, '.');
IP[2] = strtok(str, idx, '.');
IP[3] = strtok(str, idx, '.');
if(!strcmp(IP[0],"127",false) && !strcmp(IP[1],"0",false) && !strcmp(IP[2],"0",false) && !strcmp(IP[3],"1",false))
{
new string[128];
format(string,sizeof(string),"Your IP: %s is range banned!",str);
SendClientMessage(playerid,_COLOR_RED,string);
Kick(playerid);
}
return 1;
...
}
pawn Код:
public OnPlayerConnect(playerid)
{
new idx;
new IP[4][256];
new str[128];
GetPlayerIp(playerid,str,sizeof(str));
IP[0] = strtok(str, idx, '.');
IP[1] = strtok(str, idx, '.');
IP[2] = strtok(str, idx, '.');
IP[3] = strtok(str, idx, '.');
if(!strcmp(IP[0],"127",false) && !strcmp(IP[1],"0",false) && !strcmp(IP[2],"*",false) && !strcmp(IP[3],"*",false))
{
new string[128];
format(string,sizeof(string),"Your IP: %s is range banned!",str);
SendClientMessage(playerid,_COLOR_RED,string);
Kick(playerid);
}
return 1;
...
}