SA-MP Forums Archive
Problem with IPs - 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: Problem with IPs (/showthread.php?tid=67907)



Problem with IPs - x-cutter - 05.03.2009

Hello

I made a custom ban command so it can be edited script-wise. When an admin uses /ban [playerid], it would write, like 192.168.0.1=1 in, example, banlist.ini into scriptfiles. If he is rangebanned it will write 192.168.*.*=1

The thing is that when a player connects, I can't figure out how to check if the player's IP has been rangebanned. Like if he connects with IP:192.168.23.102.

How can I check if his IP's rangebanned? (PS : I use different ranges at time)

Thanks alot for your time.

- X_Cutter


Re: Problem with IPs - [RP]Rav - 05.03.2009

I have something like this in my script

pawn Код:
new ip[32],string[256];
GetPlayerIp(playerid,ip,32);

new idx = strfind(ip1, ".",true);
new idx2 = strfind(ip1, ".", true, idx+1);

if (strcmp(ip1, *insert stored ip here*, true, idx2) == 0)
{
  // here you go
}



Re: Problem with IPs - x-cutter - 05.03.2009

Quote:
Originally Posted by Rav
I have something like this in my script

pawn Код:
new ip[32],string[256];
GetPlayerIp(playerid,ip,32);

new idx = strfind(ip1, ".",true);
new idx2 = strfind(ip1, ".", true, idx+1);

if (strcmp(ip1, *insert stored ip here*, true, idx2) == 0)
{
  // here you go
}
Hmm yes would make sense.
Thanks alot :P

- X Cutter