IP Banning problem [FILE] - 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)
+--- Thread: IP Banning problem [FILE] (
/showthread.php?tid=418286)
IP Banning problem [FILE] -
Infinity90 - 24.02.2013
When I ban someone it saves in a file named "BannedIPS.txt", it saves there ip, name, who banned them, reason.
But when the player connects, I need to make it read the file and check if the IP in the file matches the one the player has, if it's a match, he will be sent a dialog saying make a ban appeal. I made this but if I enter a random IP in the file it says the players banned (It doesn't check if the IPs are the same).
pawn Код:
new string2212
[64],str123
[255];
new File:example
= fopen("BannedIPs.txt", io_read
);
while(fread(example, string2212
)) { if(strcmp(playerip, string2212, true,
16)) { format(str123,
sizeof(str123
),
"{00FF40}Your IP has been banned from this server\nOutput: %s\n{FF8000}To request a unban, visit http://www.gta-zombies.net and take a screen shot of this!",string2212
);
ShowPlayerDialog
(playerid,
9781,DIALOG_STYLE_MSGBOX,
"{FF0000}You're banned from this server.",str123,
"Okay",
"");
SetTimerEx
("KickPlayer",
1000,
0,
"i",playerid
);
} fclose(example
);
return 1;
}
Re: IP Banning problem [FILE] -
Misiur - 24.02.2013
Strcmp returns 0 when the strings are matching.
Re: IP Banning problem [FILE] -
ReVo_ - 24.02.2013
if(!strcmp(playerip, string2212, true, 16)) {
Re: IP Banning problem [FILE] -
Infinity90 - 24.02.2013
Still never made a difference. Still says that the other IP matches my'n when it doesn't :L
EDIT: Thanks ReVo_, it worked. +rep'd you.