This is how I /edithouse create
Code:
new houseid = FreeHouseID();
HouseInfo[houseid][Pickup] = CreatePickup(1273, 23, HouseInfo[houseid][ExteriorPos][0], HouseInfo[houseid][ExteriorPos][1], HouseInfo[houseid][ExteriorPos][2], HouseInfo[houseid][ExteriorWorld]);
format(housestring, sizeof(housestring), "{70ff83}This house is for sell!\nPrice: %d\nType /buyhouse to buy it\nType /enter to go inside", HouseInfo[houseid][Price]);
HouseInfo[houseid][Label] = Create3DTextLabel(housestring, COLOR_ORANGE, HouseInfo[houseid][ExteriorPos][0], HouseInfo[houseid][ExteriorPos][1], HouseInfo[houseid][ExteriorPos][2], 40, HouseInfo[houseid][ExteriorWorld], 0);
This is how I /edithouse delete id
Code:
new id;
HouseInfo[id][server_ID] = id;
DestroyPickup(HouseInfo[id][Pickup]);
DestroyDynamic3DTextLabel(HouseInfo[id][Label]);
This is how I load:
Code:
for(new i = 0; i < rows && i < MAX_HOUSES; i ++)
{
if(HouseInfo[i][ForSell] > 0)
{
HouseInfo[i][Pickup] = CreatePickup(1273, 23, HouseInfo[i][ExteriorPos][0], HouseInfo[i][ExteriorPos][1], HouseInfo[i][ExteriorPos][2], HouseInfo[i][ExteriorWorld]);
format(housestring, sizeof(housestring), "{70ff83}This house is for sell!\nPrice: %d\nType /buyhouse to buy it\nType /enter to go inside", HouseInfo[i][Price]);
HouseInfo[i][Label] = Create3DTextLabel(housestring, COLOR_ORANGE, HouseInfo[i][ExteriorPos][0], HouseInfo[i][ExteriorPos][1], HouseInfo[i][ExteriorPos][2], 40, HouseInfo[i][ExteriorWorld], 0);
}
if(HouseInfo[i][ForSell] < 1)
{
HouseInfo[i][Pickup] = CreatePickup(1273, 23, HouseInfo[i][ExteriorPos][0], HouseInfo[i][ExteriorPos][1], HouseInfo[i][ExteriorPos][2], HouseInfo[i][ExteriorWorld]);
format(housestring, sizeof(housestring), "{70ff83}House\nOwner: %s\nType /enter go to inside", HouseInfo[i][Owner]);
HouseInfo[i][Label] = Create3DTextLabel(housestring, COLOR_ORANGE, HouseInfo[i][ExteriorPos][0], HouseInfo[i][ExteriorPos][1], HouseInfo[i][ExteriorPos][2], 40, HouseInfo[i][ExteriorWorld], 0);
}
}
Code:
FreeHouseID()
{
for(new i=1; i<sizeof(HouseInfo); i++)
{
if(HouseInfo[i][server_ID]==0) return i;
}
return 0;
}