IP Banning problem [FILE]
#1

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

Strcmp returns 0 when the strings are matching.
Reply
#3

if(!strcmp(playerip, string2212, true, 16)) {
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)