House system - again >_<
#1

Hey guys,

Im still having troubles with the house system im making. The data doesnt load in the variables. The coords are just fine, since they are at the right place. But when it comes to the owner or the price, it just doesnt load them in the variables.

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_%s", .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 \nRank: %i", i, HouseInfo[i][Price], HouseInfo[i][Rank] ), print( "Label 0" );
            case 1: format( LabelString, sizeof LabelString, "Huis ID: %i \nEigenaar: %s \nPrijs: $%i \nRank: %i", i, HouseInfo[i][Owner], HouseInfo[i][Price], HouseInfo[i][Rank] ), print( "Label 1" );
        }
       
        HouseInfo[i][HouseLabel] = Create3DTextLabel( LabelString, COLOR_GREEN, HouseInfo[i][XPos], HouseInfo[i][YPos], HouseInfo[i][ZPos], 25.0, HouseInfo[i][VirtualWorld] );
        printf( "HouseOwners: %s", HouseInfo[i][Owner] );

        HouseCount ++;
        printf( "Loaded house ID: %i", i );
    }
    return 1;
}

forward LoadHouses_data(id, name[], value[]);
public LoadHouses_data(id, name[], value[])
{
    INI_Int( "Price", HouseInfo[id][Price] );
    INI_Int( "Owned", HouseInfo[id][Owned] );
    INI_String( "Owner", HouseInfo[id][Owner], 24 );
    INI_Bool( "Locked", HouseInfo[id][Locked] );
    INI_Int( "House_Rank", HouseInfo[id][Rank] );
   
    INI_Float( "Pickup_X", HouseInfo[id][XPos] );
    INI_Float( "Pickup_Y", HouseInfo[id][YPos] );
    INI_Float( "Pickup_Z", HouseInfo[id][ZPos] );
    INI_Int( "Virtualworld", HouseInfo[id][VirtualWorld] );
    INI_Int( "Interior", HouseInfo[id][Interior] );

    INI_Float( "X_Inside", HouseInfo[id][XPosInside] );
    INI_Float( "Y_Inside", HouseInfo[id][YPosInside] );
    INI_Float( "Z_Inside", HouseInfo[id][ZPosInside] );
    INI_Int( "Virtualworld_inside", HouseInfo[id][VWInside] );
    INI_Int( "Interior_inside", HouseInfo[id][INTInside] );
    return 1;
}
That is my function to load all the houses.
Everything saves fine in the file, for example see the one below:

Код:
[data]
Prijs = 100
Owned = 1
Eigenaar = TerrorCorp
Locked = true
House_Rank = 3
Pickup_X = 1104.836914
Pickup_Y = -358.861602
Pickup_Z = 73.992187
Virtualworld = 0
Interior = 0
X_Inside = 0.000000
Y_Inside = 0.000000
Z_Inside = 0.000000
Virtualworld_inside = 1
Interior_inside = 1
Dont bother the x/y/z inside, vw inside, int inside; i didnt make that yet! As you can see it saves just fine.
Though, it doesnt show the owner and the price IG.

~Wesley
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)