stock SaveHouses()
{
if(!fexist("ODA/houses.cfg")) fcreate("ODA/houses.cfg");
new idx = 1, File:file;
new string[256];
while(idx < MAX_HOUSES)
{
format(string, sizeof(string), "%d || %d || %d || %s || %f || %f || %f || %d ||\r\n",HouseInfo[idx][hLevel],HouseInfo[idx][hPrice],HouseInfo[idx][hStatus],HouseInfo[idx][hOwner],HouseInfo[idx][hX],HouseInfo[idx][hY],HouseInfo[idx][hZ],HouseInfo[idx][hMoney]);
if(idx == 1)
{
file = fopen("ODA/houses.cfg", io_write);
}
else
{
file = fopen("ODA/houses.cfg", io_append);
}
fwrite(file, string);
fclose(file);
idx++;
}
print("Houses saved successfully.");
}
2347.128662 || -1264.981079 || 27.976562 //This is the bugged coordinates that it gives
//and this is the coordinate i created the biz at
2347.1917,-1265.0759,27.9766 //this is where the biz should be create when i restart the server.
stock LoadHouses()
{
new hinfo[21][32];
new string[256];
new File:file = fopen("ODA/houses.cfg", io_read);
if(file)
{
new idx = 1;
while(idx < MAX_HOUSES)
{
fread(file, string);
split(string, hinfo, '|');
HouseInfo[idx][hLevel] = strval(hinfo[0]);
HouseInfo[idx][hPrice] = strval(hinfo[1]);
HouseInfo[idx][hStatus] = strval(hinfo[2]);
format(HouseInfo[idx][hOwner], 32, "%s", hinfo[3]);
HouseInfo[idx][hX] = floatstr(hinfo[4]);
HouseInfo[idx][hY] = floatstr(hinfo[5]);
HouseInfo[idx][hZ] = floatstr(hinfo[6]);
HouseInfo[idx][hMoney] = strval(hinfo[7]);
if(HouseInfo[idx][hLevel])
{
HouseInfo[idx][hPickup] = CreateDynamicPickup(1273, 1, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ], 0);
if(!strcmp("The State", HouseInfo[idx][hOwner])) format(string, sizeof(string), "[House ID: %d, House (Lvl: %d)]\n Owner: %s\n Status: For Sale\n$%d", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], HouseInfo[idx][hPrice]);
else format(string, sizeof(string), "[House ID: %d, House (Lvl: %d)]\n Owner: %s\n Status: %s", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], RHS(idx));
HouseInfo[idx][hText] = CreateDynamic3DTextLabel(string, -1, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]+0.3, 15);
}
idx++;
}
}
print("Houses loaded successfully.");
return 1;
}
The problem is that the hinfo variable have to be a float variable.
Create a sperate variable for the coordinates anderen load them seperatly. |
The problem is that the hinfo variable have to be a float variable.
Create a sperate variable for the coordinates anderen load them seperatly. |