INI problem
#2

Well you could try this:

pawn Код:
stock LoadDoors()
{
    if(!fexist("Doors.cfg")) return 1;

    new szFileStr[1024], d, File: iFileHandle = fopen("Doors.cfg", io_read);
   
    while(d < MAX_DOORS && fread(iFileHandle, szFileStr)) {
        if(!sscanf(szFileStr, "p<|>s[64]s[40]dddffffffff",
        DoorData[d][dName],
        DoorData[d][dPass],
        DoorData[d][deVW],
        DoorData[d][diVW],
        DoorData[d][diInt],
        DoorData[d][dePos][0],
        DoorData[d][dePos][1],
        DoorData[d][dePos][2],
        DoorData[d][dePos][3],
        DoorData[d][diPos][0],
        DoorData[d][diPos][1],
        DoorData[d][diPos][2],
        DoorData[d][diPos][3]))
        {
            if(DoorData[d][deVW] == 0)
            {
                createDoor(d); //Not sure which of these should go first, but this seems the most logical
                d++;
            }
        }
    }
    printf("%d doors loaded", d);
    return fclose(iFileHandle);
}
In your current code the 'd' variable never goes up. The following:
pawn Код:
createDoor(d++);
Actually means:
pawn Код:
createDoor(d + 1);
Whereas what you're trying to do is:
pawn Код:
createDoor(d);
d++;
Also I split the if(...) statement in two statements as the second part was dependent on the sscanf in the first part and I'm not too sure about how that works out normally speaking (should work out just fine btw)
Reply


Messages In This Thread
INI problem - by MattSlater - 30.12.2012, 21:27
Re: INI problem - by Hiddos - 30.12.2012, 21:46
Re: INI problem - by MattSlater - 30.12.2012, 21:56
Re: INI problem - by MattSlater - 30.12.2012, 22:13
Re: INI problem - by MattSlater - 31.12.2012, 01:49
Re: INI problem - by Dragonborn - 31.12.2012, 02:07
Re: INI problem - by MattSlater - 31.12.2012, 03:02
Re: INI problem - by Dragonborn - 31.12.2012, 03:21
Re: INI problem - by MattSlater - 31.12.2012, 03:23
Re: INI problem - by Dragonborn - 31.12.2012, 04:04

Forum Jump:


Users browsing this thread: 1 Guest(s)