INI_ParseFile
#1

Hey guys,

Im trying to load some data from a file in variables, but somehow im getting stuck using INI_ParseFile.
Somehow the things arent loading into the variables. They all just stay 0.000.
pawn Код:
stock LoadHouses()
{
    for( new i = 0; i <= MAX_HOUSES; i ++ )
    {
        printf( "I: %i", i );
        if( !fexist( hPath(i) ) ) break;
       
        INI_ParseFile(hPath(i), "LoadHouses_%i", .bExtra = true, .extra = i);
       
        printf( "HouseInfo[i][XPos] %0.4f || HouseInfo[i][YPos] %0.4f || HouseInfo[i][ZPos] %0.4f", HouseInfo[i][XPos], HouseInfo[i][YPos], HouseInfo[i][ZPos] );
        HouseEnter[i]  = CreateDynamicCP( HouseInfo[i][XPos], HouseInfo[i][YPos], HouseInfo[i][ZPos], 1.5, HouseInfo[i][VirtualWorld] );
        HouseExit[i] = CreateDynamicCP( 443.9237, 509.4609, 1001.4195, 1.5, HouseInfo[i][VirtualWorld] );
       
        new LabelString[128];
        switch( HouseInfo[i][Owned] )
        {
            case 0: format( LabelString, sizeof LabelString, "Dit huis is nog te koop! \nHuis ID: %i \nEigenaar: N/A \nPrijs: $%i", i, HouseInfo[i][Price] ), print( "Label 0" );
            case 1: format( LabelString, sizeof LabelString, "Huis ID: %i \nEigenaar: %s \nPrijs: $%i", i, HouseInfo[i][Owner], HouseInfo[i][Price] ), print( "Label 1" );
        }
       
        HouseInfo[i][HouseLabel] = Create3DTextLabel( LabelString, COLOR_GREEN, HouseInfo[i][XPos], HouseInfo[i][YPos], HouseInfo[i][ZPos], 25.0, HouseInfo[i][VirtualWorld] );
        HouseCount ++;
        printf( "Loaded house ID: %i", i );
    }
    return 1;
}
Im using that piece to load all the houses, and the public for the INI_ParseFile:
pawn Код:
forward LoadHouses_data(id, name[], value[]);
public LoadHouses_data(id, name[], value[])
{
    INI_Int( "Price", HouseInfo[id][Price] );
    printf( "Price: %i", HouseInfo[id][Price] );
   
    INI_Int( "Owned", HouseInfo[id][Owned] );
    printf( "Owned: %i", HouseInfo[id][Owned] );
   
    INI_Float( "Pickup_X", HouseInfo[id][XPos] );
    printf( "X: %f", HouseInfo[id][XPos] );
   
    INI_Float( "Pickup_Y", HouseInfo[id][YPos] );
    printf( "Y: %f", HouseInfo[id][YPos] );
   
    INI_Float( "Pickup_Z", HouseInfo[id][ZPos] );
    printf( "Z: %f", HouseInfo[id][ZPos] );
   
    INI_Int( "Virtualworld", HouseInfo[id][VirtualWorld] );
    printf( "VW: %i", HouseInfo[id][VirtualWorld] );
   
    INI_String( "Owner", HouseInfo[id][Owner], 24 );
    printf( "Owner: %s", HouseInfo[id][Owner] );
   
    INI_Bool( "Locked", HouseInfo[id][Locked] );
    printf( "Locked: %b", HouseInfo[id][Locked] );
    return 1;
}
And this is the output:
Код:
[09:24:42] I: 0
[09:24:42] HouseInfo[i][XPos] 0.0000 || HouseInfo[i][YPos] 0.0000 || HouseInfo[i][ZPos] 0.0000
[09:24:42] HouseCount: 0
[09:24:42] I: 1
[09:24:42] HouseInfo[i][XPos] 0.0000 || HouseInfo[i][YPos] 0.0000 || HouseInfo[i][ZPos] 0.0000
[09:24:42] HouseCount: 1
[09:24:42] I: 2
[09:24:42] HouseInfo[i][XPos] 0.0000 || HouseInfo[i][YPos] 0.0000 || HouseInfo[i][ZPos] 0.0000
[09:24:42] HouseCount: 2
[09:24:42] I: 3
[09:24:42] HouseInfo[i][XPos] 0.0000 || HouseInfo[i][YPos] 0.0000 || HouseInfo[i][ZPos] 0.0000
[09:24:42] HouseCount: 3
[09:24:42] I: 4
~Wesley
Reply


Messages In This Thread
INI_ParseFile - by Wesley221 - 09.01.2012, 17:42
Re: INI_ParseFile - by Wesley221 - 09.01.2012, 18:47
Re: INI_ParseFile - by Wesley221 - 09.01.2012, 18:59
Re: INI_ParseFile - by Wesley221 - 09.01.2012, 19:17
Re: INI_ParseFile - by Wesley221 - 10.01.2012, 13:49
Re: INI_ParseFile - by Wesley221 - 10.01.2012, 13:51
Re: INI_ParseFile - by Jochemd - 11.01.2012, 17:09
Re: INI_ParseFile - by Wesley221 - 11.01.2012, 17:14
Re: INI_ParseFile - by Wesley221 - 12.01.2012, 19:29
AW: INI_ParseFile - by Drebin - 26.01.2012, 21:59

Forum Jump:


Users browsing this thread: 1 Guest(s)