09.06.2014, 09:49
(
Последний раз редактировалось Runn3R; 11.03.2016 в 12:11.
)
Solved.
[house] Price = 20000 Owned = 1 VirtualWorld = 0 XPos = 2270.474853 YPos = -7.504103 ZPos = 28.153547 Owner = Kevin_Crawford
stock LoadHouses()//Creating the stock function
{
new string[100];
for(new i = 0; i < MAX_HOUSES; i ++)//Creates a loop, that goes through all of the HOUSES.
{
format(string, sizeof(string), "/Houses/HouseID%i.ini", i);//formats the file path, with the biz ID
INI_ParseFile(string, "housedata", .bExtra = true, .extra = i );//This is very hard to explain, but it basically loads the info from the file(More in ****** y_ini tutorial.)
HouseEnter[i] = CreateDynamicCP(HInfo[i][XPos], HInfo[i][YPos], HInfo[i][ZPos], 1.5, HInfo[i][VirtualWorld], -1, -1, 2);//Creating the checkpoint and storing it in the HouseEnter value.
HouseExit[i] = CreateDynamicCP(443.9237, 509.4609, 1001.4195, 1.5, HInfo[i][VirtualWorld], -1, -1, 2);//Creating the house exit checkpoint and storing it in the HouseExit value.
switch(HInfo[i][Owned])//Using the "switch" method to check if the house is owned
{
case 0: format(string, sizeof(string), "Owned: No\nPrice: %i", HInfo[i][Price]);//If it isnt...
case 1: format(string, sizeof(string), "Owned: Yes\nPrice: %i\nOwner: %s", HInfo[i][Price], HInfo[i][Owner]);//If it is...
}
HInfo[i][HouseLabel] = Create3DTextLabel(string, 0xFF0000FF, HInfo[i][XPos], HInfo[i][YPos], HInfo[i][ZPos], 25.0, HInfo[i][VirtualWorld]);//Creating the label with the formatted string.
HouseCount ++;//+ counting the HouseCount var.
}
return 1;
}
forward housedata(id, name[], value[]);
public housedata(id, name[], value[])
{
INI_Int("Owned", HInfo[id][Owned]);
INI_Float("XPos", HInfo[id][XPos]);
INI_Float("YPos", HInfo[id][YPos]);
INI_Float("ZPos", HInfo[id][ZPos]);
INI_Int("VirtualWorld", HInfo[id][VirtualWorld]);
INI_String("Owner", HInfo[id][Owner], 24);
return 1;
}
SaveHouse();
forward housedata_id(i, name[], value[]);
public housedata_id(i, name[], value[])
forward housedata_data(i, name[], value[]);
public housedata_data(i, name[], value[])