PHP код:
function LoadHouses()
{
new PropertyString[1024], filas, houses;
if(cache_get_row_count(filas))
{
for(new i = 0; i <= filas; i++)
{
new j = i - 1;
HouseInfo[i][hID] = i;
HouseInfo[i][hEntrancex] = cache_get_field_content_float(j, "Entrancex");
HouseInfo[i][hEntrancey] = cache_get_field_content_float(j, "Entrancey");
HouseInfo[i][hEntrancez] = cache_get_field_content_float(j, "Entrancez");
HouseInfo[i][hExitx] = cache_get_field_content_float(j, "Exitx");
HouseInfo[i][hExity] = cache_get_field_content_float(j, "Exity");
HouseInfo[i][hExitz] = cache_get_field_content_float(j, "Exitz");
HouseInfo[i][hHealth] = cache_get_field_content_int(j, "Health");
HouseInfo[i][hArmour] = cache_get_field_content_int(j, "Armour");
cache_get_field_content(j, "Owner", HouseInfo[i][hOwner], SQL, 129);
HouseInfo[i][hValue] = cache_get_field_content_int(j, "Value");
HouseInfo[i][hInt] = cache_get_field_content_int(j, "Int");
HouseInfo[i][hLock] = cache_get_field_content_int(j, "Lockk");
HouseInfo[i][hOwned] = cache_get_field_content_int(j, "Owned");
HouseInfo[i][hRent] = cache_get_field_content_int(j, "Rent");
HouseInfo[i][hRentabil] = cache_get_field_content_int(j, "Rentabil");
HouseInfo[i][hTakings] = cache_get_field_content_int(j, "Takings");
HouseInfo[i][hDate] = cache_get_field_content_int(j, "Date");
HouseInfo[i][hLevel] = cache_get_field_content_int(j, "Level");
if(HouseInfo[i][hOwned] == 0)
{
format(PropertyString, sizeof(PropertyString), "{009900}House %d\nThis house is for sale\nPrice: {00FF00}$%s\n{009900}Level: {00FF00}%d\n{009900}Type {00FF00}/buyhouse {009900}to buy",i,Decimal(HouseInfo[i][hValue]),HouseInfo[i][hLevel]);
HouseLabel[i] = CreateDynamic3DTextLabel(PropertyString ,0x09FF00FF,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez],25, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, -1, -1, -1, 100.0);
}
else if(HouseInfo[i][hOwned] == 1)
{
if(HouseInfo[i][hRentabil] == 1)
{
format(PropertyString, sizeof(PropertyString), "{009900}House %d\nOwner: {00FF00}%s\n{009900}Level: {00FF00}%d",i,HouseInfo[i][hOwner],HouseInfo[i][hLevel]);
HouseLabel[i] = CreateDynamic3DTextLabel(PropertyString ,0x09FF00FF,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez],25, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, -1, -1, -1, 100.0);
}
else
{
format(PropertyString, sizeof(PropertyString), "{009900}House %d\nOwner: {00FF00}%s\n{009900}Level: {00FF00}%d\n{009900}Rent: {00FF00}$%s\n{009900}to rent a room type {00FF00}/rentroom",i,HouseInfo[i][hOwner],HouseInfo[i][hLevel],Decimal(HouseInfo[i][hRent]));
HouseLabel[i] = CreateDynamic3DTextLabel(PropertyString ,0x09FF00FF,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez],25, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, -1, -1, -1, 100.0);
}
}
houses++;
}
}
printf("[MYSQL] Houses: %d", houses);
}