File not reading correctly
#1

pawn Код:
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 0;
    }
The output in the file that it's meant to read is
EXAMPLE:
123.222.22.2 \r\n - Reads
127.0.0.1 \r\n - Doesn't read
123.123.123.2 \r\n - Doesn't read
----------------
It's only reading the first line, ones below that don't get read.
Reply
#2

Anyone? I need help asap. Thanks in advance.
Reply
#3

Reread your code step by step. Look what do you see. Now do it again. And again. And one more time to be sure. Now you know that loop is fired up once. But why doesn't it work further?

pawn Код:
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); //This line
    return 0; //This line
}
What does fclose do? What does return do? You should know that by now.

pawn Код:
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);
        break;
    }
}
fclose(example);
return 0;
Have fun
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)