GetPlayerIP - get the range - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: GetPlayerIP - get the range (
/showthread.php?tid=194135)
GetPlayerIP - get the range -
OrlGiNS - 28.11.2010
Код:
public OnPlayerConnect(playerid)
{
....
new string[128];
format(string, sizeof(string), "playersacc/%s.cer", plname);
new IPz[16];
GetPlayerIp(playerid, IPz, sizeof(IPz));
if(!strcmp(IPz, "197.75.1*") && !fexist(string))
{
SendClientMessage(playerid, REDz, "Your Ip is range banned ;O");
Kick(playerid);
}
return 1;
}
This is to check the Range of an IP of a player that connects to a server, if this one is not registered he gets kicked because he can't play with this IP.
But it just doesn't work, does anybody know what I've done wrong please? :S
Re: GetPlayerIP - get the range -
Mauzen - 28.11.2010
You can use
!strcmp(IPz, "197.75.1", false, 8 )
as it will only check the first 8 characters. That means, it will detect if the IP starts with your string.
Re: GetPlayerIP - get the range -
OrlGiNS - 28.11.2010
Yeah man, thanks it worked :P