INI_ParseFile
#4

Whenever i create the house, ill write in it immediately. Aswell as you buy/sell the house, it just changes the name etc.

pawn Код:
stock CreateHouse( playerid, price, owned, Float:x, Float:y, Float:z, virtualworld, ownername[])
{
    new id = HouseCount, INI:pFile = INI_Open(hPath(id)), Label[128];
    HouseInfo[id][Price] = price;
    HouseInfo[id][Owned] = owned;
    HouseInfo[id][XPos] = x;
    HouseInfo[id][YPos] = y;
    HouseInfo[id][ZPos] = z;
    HouseInfo[id][VirtualWorld] = virtualworld;
    strset( HouseInfo[id][Owner], ownername );
   
    HouseEnter[id]  = CreateDynamicCP( x, y, z, 1.5, GetPlayerVirtualWorld( playerid ) );
    HouseExit[id] = CreateDynamicCP( 443.9237, 509.4609, 1001.4195, 1.5, virtualworld );

    INI_WriteInt( pFile, "Prijs", price );
    INI_WriteInt( pFile, "Owned", 0 );
    INI_WriteInt( pFile, "Virtualworld", GetPlayerVirtualWorld( playerid ) );
    INI_WriteFloat( pFile, "Pickup_X", x );
    INI_WriteFloat( pFile, "Pickup_Y", y );
    INI_WriteFloat( pFile, "Pickup_Z", z );
    INI_WriteString( pFile, "Eigenaar", "HeeftGeenEigenaar" );
    INI_WriteBool( pFile, "Locked", true );
    INI_Close( pFile );
   
    switch( owned )
    {
        case 0: format( Label, sizeof Label, "Dit huis is nog te koop! \nHuis ID: %i \nEigenaar: N/A \nPrijs: $%i", id, price );
        case 1: format( Label, sizeof Label, "Huis ID: %i \nEigenaar: %s \nPrijs: $%i", id, ownername, price );
    }
   
    HouseInfo[id][HouseLabel] = Create3DTextLabel( Label, COLOR_GREEN, x, y, z, 25.0, GetPlayerVirtualWorld( playerid ) );
    HouseCount ++;
    return 1;
}
Example file after creation:
Код:
Prijs = 100
Owned = 0
Virtualworld = 0
Pickup_X = 2259.464599
Pickup_Y = -86.412368
Pickup_Z = 26.499542
Eigenaar = HeeftGeenEigenaar
Locked = true
Edit:
I actually noticed i didnt have INI_SetTag, added everywhere where it was needed, still not working
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)