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;
}
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;
}
[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
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;
}
Prijs = 100 Owned = 0 Virtualworld = 0 Pickup_X = 2259.464599 Pickup_Y = -86.412368 Pickup_Z = 26.499542 Eigenaar = HeeftGeenEigenaar Locked = true
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] = virtuwalworld;
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_SetTag( pFile, "tag" );
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;
}
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", 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;
}
HouseInfo[id][VirtualWorld] = virtuwalworld;
Eehm...
pawn Код:
|