03.07.2014, 18:30
pawn Код:
for(new h;h < MAX_HOUSES;h++)
{
new hFile[35];
format(hFile, 35, "Namai/%d.ini" ,h);
if(fexist(hFile))
{
INI_ParseFile(hFile, "LoadHouseData_%s", .bExtra = true, .extra = h);
if(HouseInfo[h][hCreated] == 1)
{
if(HouseInfo[h][hOwned] == 0)
{
new labelstring[500];
format(labelstring,sizeof(labelstring),""TCRED"Patalpa parduodama!\n"TCCYAN"Kaina: "TCRED"%d LT\n"TCCYAN"Adresas: "TCRED"%s\n"TCCYAN"Informacija: "TCRED"%s",HouseInfo[h][hPrice],HouseInfo[h][hAddress],HouseInfo[h][hDescription]);
HouseInfo[h][hLabel] = CreateDynamic3DTextLabel(labelstring, COL_GREEN, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ], 20);
HouseInfo[h][hPickup] = CreateDynamicPickup(1273, 1, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ]);
HouseInfo[h][hIcon] = CreateDynamicMapIcon(HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ], 31, 0,0);
}
else
{
new labelstring[500];
format(labelstring, sizeof(labelstring),""TCCYAN"Savininkas: "TCRED"%s\n"TCCYAN"Nuoma: "TCRED"%s\n"TCCYAN"Nuomos kaina: "TCRED"%d\n"TCCYAN"Adresas: "TCRED"%s", HouseInfo[h][hOwnerName],HouseInfo[h][hRenter],HouseInfo[h][hRentPrice],HouseInfo[h][hAddress]);
HouseInfo[h][hLabel] = CreateDynamic3DTextLabel(labelstring, COL_GREEN, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ], 20);
HouseInfo[h][hPickup] = CreateDynamicPickup(1272, 1, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ]);
HouseInfo[h][hIcon] = CreateDynamicMapIcon(HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ], 32, 0,0);
if(HouseInfo[h][hhasAGarage] == 1)
{
new garagelabel[200];
format(garagelabel, sizeof(garagelabel),""TCRED"Garazas ("TCCYAN"Ieiti iseit ([C] arba [H]"TCRED")\n"TCCYAN"Savininkas: "TCRED"%s", HouseInfo[h][hOwnerName]);
HouseInfo[h][hGLabel] = CreateDynamic3DTextLabel(garagelabel, COL_GREEN, HouseInfo[h][hGEnterX], HouseInfo[h][hGEnterY], HouseInfo[h][hGEnterZ], 20);
}
}
printf("House ID %d EnterX: %d EnterY: %d EnterZ: %d", h,HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ]);
}
}
}
forward LoadHouseData_data(h,name[],value[]);
public LoadHouseData_data(h,name[],value[])
{
INI_Int("Created",HouseInfo[h][hCreated]);
INI_Int("Owned",HouseInfo[h][hOwned]);
INI_String("Owner",HouseInfo[h][hOwnerName],MAX_PLAYER_NAME);
INI_Int("Locked",HouseInfo[h][hLocked]);
INI_Float("EnterX",HouseInfo[h][hEnterX]);
INI_Float("EnterY",HouseInfo[h][hEnterY]);
INI_Float("EnterZ",HouseInfo[h][hEnterZ]);
INI_Float("ExitX",HouseInfo[h][hExitX]);
INI_Float("ExitY",HouseInfo[h][hExitY]);
INI_Float("ExitZ",HouseInfo[h][hExitZ]);
INI_Float("GarageEnterX",HouseInfo[h][hEnterX]);
INI_Float("GarageEnterY",HouseInfo[h][hEnterY]);
INI_Float("GarageEnterZ",HouseInfo[h][hEnterZ]);
INI_Float("GarageExitX",HouseInfo[h][hGExitX]);
INI_Float("GarageExitY",HouseInfo[h][hGExitY]);
INI_Float("GarageExitZ",HouseInfo[h][hGExitZ]);
INI_Float("GarageAngle",HouseInfo[h][hGAngle]);
INI_Int("GarageOccupied",HouseInfo[h][hGIsOccupied]);
INI_Int("GarageLocked",HouseInfo[h][hGIsLocked]);
INI_Int("HasAGarage",HouseInfo[h][hhasAGarage]);
INI_String("Address",HouseInfo[h][hAddress],32);
INI_String("Description",HouseInfo[h][hDescription],32);
INI_Int("Interior",HouseInfo[h][hInterior]);
INI_Int("VirtualWorld",HouseInfo[h][hVirtualWorld]);
INI_Int("Price",HouseInfo[h][hPrice]);
INI_Int("IsRentable",HouseInfo[h][hIsRentable]);
INI_Int("RentPrice",HouseInfo[h][hRentPrice]);
INI_String("Renter",HouseInfo[h][hRenter],MAX_PLAYER_NAME);
INI_Int("IsRented",HouseInfo[h][hIsRented]);
INI_Int("Money",HouseInfo[h][hMoney]);
INI_Int("Gun1",HouseInfo[h][hGun1]);
INI_Int("Ammo1",HouseInfo[h][hAmmo1]);
INI_Int("Gun2",HouseInfo[h][hGun2]);
INI_Int("Ammo2",HouseInfo[h][hAmmo2]);
INI_Int("Taxes",HouseInfo[h][hTaxes]);
return 1;
}
And DEBUG:
Код:
[21:27:36] [21:27:36] [21:27:36] House ID 0 EnterX: 0 EnterY: 0 EnterZ: 0 [21:27:36] House ID 1 EnterX: 0 EnterY: 0 EnterZ: 0 [21:27:36] House ID 2 EnterX: 0 EnterY: 0 EnterZ: 0 [21:27:36] House ID 3 EnterX: 0 EnterY: 0 EnterZ: 0 [21:27:36] \ -----------------------\ [21:27:36] \SFR-RP - Beta!-\ [21:27:36] \-------------------------\ [21:27:36] Number of vehicle models: 0
WHY?