Problem with IPs
#1

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
Reply
#2

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
}
Reply
#3

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)