16.01.2019, 08:37
Код:
forward LoadHouses();
public LoadHouses()
{
new PlayerName1[MAX_PLAYER_NAME], str[500];
for(new id=1; id<sizeof(HouseInfo); id++)
{
HouseInfo[id][ID]= cache_get_field_content_int(dbhandle, "ID");
HouseInfo[id][Owner] = cache_get_field_content(id, "Owner", PlayerName1, dbhandle);
strmid(HouseInfo[id][Owner], PlayerName1, 0, sizeof(PlayerName1), sizeof(PlayerName1));
HouseInfo[id][HouseX]= cache_get_field_content_float(dbhandle, "HX");
HouseInfo[id][HouseY]= cache_get_field_content_float(dbhandle, "HY");
HouseInfo[id][HouseZ]= cache_get_field_content_float(dbhandle, "HZ");
HouseInfo[id][HouseXX]= cache_get_field_content_float(dbhandle, "HouseXX");
HouseInfo[id][HouseYY]= cache_get_field_content_float(dbhandle, "HouseYY");
HouseInfo[id][HouseZZ]= cache_get_field_content_float(dbhandle, "HouseZZ");
HouseInfo[id][World]= cache_get_field_content_int(dbhandle, "World");
HouseInfo[id][Price]= cache_get_field_content_int(dbhandle, "Price");
HouseInfo[id][ForSale]= cache_get_field_content_int(dbhandle, "ForSale");
if(HouseInfo[id][ForSale] == 1)
{
HouseInfo[id][Pickup] = AddStaticPickup(1273, 23, HouseInfo[id][HouseX], HouseInfo[id][HouseY], HouseInfo[id][HouseZ], HouseInfo[id][World]);
format(str, sizeof(str), "House\nPrice: %d\nType /buyhouse to purchase it\nType /enter to go inside", HouseInfo[id][Price]);
HouseTxt[id]=CreateDynamic3DTextLabel(str ,COLOR_ORANGE, HouseInfo[id][HouseX], HouseInfo[id][HouseY], HouseInfo[id][HouseZ],30.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 7.0);
return 1;
}
if(HouseInfo[id][ForSale] == 0)
{
HouseInfo[id][Pickup] = AddStaticPickup(1273, 23, HouseInfo[id][HouseX], HouseInfo[id][HouseY], HouseInfo[id][HouseZ], HouseInfo[id][World]);
format(str, sizeof(str), "House\nOwner: %s\nType /enter to go inside", HouseInfo[id][Owner]);
HouseTxt[id]=CreateDynamic3DTextLabel(str ,COLOR_ORANGE, HouseInfo[id][HouseX], HouseInfo[id][HouseY], HouseInfo[id][HouseZ],30.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 7.0);
return 1;
}
}
return 1;
}


