29.03.2019, 01:36
When I try to load house system, it loads only one house perfectly
OnHouseLoaded function
UpdateHouse:
My query (In OnGamemodeInit)
mysql_log
Database
OnHouseLoaded function
PHP Code:
public OnHouseLoaded(){
new name[32],m[512];
new num_fields,num_rows;
cache_get_data(num_rows,num_fields,dbhandle);
if(!num_rows){
print("Total House Loaded : 0");
return 1;
}
for(new i=0; i<num_rows; i++)
{
new id = GetFreeHouseID();
HouseInfo[id][HouseID] = id;
HouseInfo[id][HouseSQLID] = cache_get_field_content_int(i, "ID", dbhandle);
HouseInfo[id][HouseOwnerID] = cache_get_field_content_int(i, "OwnerID", dbhandle);
HouseInfo[id][HouseMarketPrice] = cache_get_field_content_int(i, "MarketPrice", dbhandle);
HouseInfo[id][HouseExteriorX] = cache_get_field_content_float(i, "ExteriorX", dbhandle);
HouseInfo[id][HouseExteriorY] = cache_get_field_content_float(i, "ExteriorY", dbhandle);
HouseInfo[id][HouseExteriorZ] = cache_get_field_content_float(i, "ExteriorZ", dbhandle);
HouseInfo[id][HouseExteriorA] = cache_get_field_content_float(i, "ExteriorA", dbhandle);
HouseInfo[id][HouseExteriorInt] = cache_get_field_content_int(i, "ExteriorInt", dbhandle);
HouseInfo[id][HouseExteriorVW] = cache_get_field_content_int(i, "ExteriorVW", dbhandle);
HouseInfo[id][HouseInteriorX] = cache_get_field_content_float(i, "InteriorX", dbhandle);
HouseInfo[id][HouseInteriorY] = cache_get_field_content_float(i, "InteriorY", dbhandle);
HouseInfo[id][HouseInteriorZ] = cache_get_field_content_float(i, "InteriorZ", dbhandle);
HouseInfo[id][HouseInteriorA] = cache_get_field_content_float(i, "InteriorA", dbhandle);
HouseInfo[id][HouseInteriorInt] = cache_get_field_content_int(i, "InteriorInt", dbhandle);
HouseInfo[id][HouseLocked] = cache_get_field_content_int(i, "Locked", dbhandle);
HouseInfo[id][HouseCashBox] = cache_get_field_content_int(i, "CashBox", dbhandle);
// I rrly do not like this code, but having a loop made the compiler cry :(
HouseInfo[id][HouseWeapons][0] = cache_get_field_content_int(i, "Weapons0", dbhandle);
HouseInfo[id][HouseWeapons][1] = cache_get_field_content_int(i, "Weapons1", dbhandle);
HouseInfo[id][HouseWeapons][2] = cache_get_field_content_int(i, "Weapons2", dbhandle);
HouseInfo[id][HouseWeapons][3] = cache_get_field_content_int(i, "Weapons3", dbhandle);
HouseInfo[id][HouseWeapons][4] = cache_get_field_content_int(i, "Weapons4", dbhandle);
HouseInfo[id][HouseWeapons][5] = cache_get_field_content_int(i, "Weapons5", dbhandle);
HouseInfo[id][HouseWeapons][6] = cache_get_field_content_int(i, "Weapons6", dbhandle);
HouseInfo[id][HouseWeapons][7] = cache_get_field_content_int(i, "Weapons7", dbhandle);
HouseInfo[id][HouseWeapons][8] = cache_get_field_content_int(i, "Weapons8", dbhandle);
HouseInfo[id][HouseWeapons][9] = cache_get_field_content_int(i, "Weapons9", dbhandle);
HouseInfo[id][HouseWeapons][10] = cache_get_field_content_int(i, "Weapons10", dbhandle);
HouseInfo[id][HouseWeapons][11] = cache_get_field_content_int(i, "Weapons11", dbhandle);
HouseInfo[id][HouseWeapons][12] = cache_get_field_content_int(i, "Weapons12", dbhandle);
HouseInfo[id][HouseWeapons][13] = cache_get_field_content_int(i, "Weapons13", dbhandle);
HouseInfo[id][HouseWeapons][14] = cache_get_field_content_int(i, "Weapons14", dbhandle);
HouseInfo[id][HouseWeapons][15] = cache_get_field_content_int(i, "Weapons15", dbhandle);
HouseInfo[id][HouseWeapons][16] = cache_get_field_content_int(i, "Weapons16", dbhandle);
HouseInfo[id][HouseWeapons][17] = cache_get_field_content_int(i, "Weapons17", dbhandle);
HouseInfo[id][HouseWeapons][18] = cache_get_field_content_int(i, "Weapons18", dbhandle);
HouseInfo[id][HouseWeapons][19] = cache_get_field_content_int(i, "Weapons19", dbhandle);
HouseInfo[id][HouseWeapons][20] = cache_get_field_content_int(i, "Weapons20", dbhandle);
HouseInfo[id][HousePlacePosX] = cache_get_field_content_float(i, "PlacePosX", dbhandle);
HouseInfo[id][HousePlacePosY] = cache_get_field_content_float(i, "PlacePosY", dbhandle);
HouseInfo[id][HousePlacePosZ] = cache_get_field_content_float(i, "PlacePosZ", dbhandle);
HouseInfo[id][HouseBoombox] = cache_get_field_content_int(i, "Boombox", dbhandle);
HouseInfo[id][HouseWired] = cache_get_field_content_int(i, "Wired", dbhandle);
new tmp_name[512];
cache_get_field_content(i, "Address" ,tmp_name, dbhandle);
strmid(HouseInfo[id][HouseAddress], tmp_name, 0, sizeof(tmp_name), sizeof(tmp_name));
HouseInfo[id][HouseCustomExterior] = cache_get_field_content_int(i, "CustomExterior", dbhandle);
HouseInfo[i][HouseLocked] = 1;
printf("%i |%i | %f %f %f", id,HouseInfo[id][HouseSQLID],HouseInfo[id][HouseExteriorX],HouseInfo[id][HouseExteriorY],HouseInfo[id][HouseExteriorZ]);
UpdateHousePickup(id);
}
printf("Total House Loaded: %i", num_rows);
return 1;
}
PHP Code:
UpdateHousePickup(i)
{
if(IsValidDynamic3DTextLabel(HouseLabel[i]))
{
DestroyDynamic3DTextLabel(HouseLabel[i]);
}
if(IsValidDynamicPickup(HousePickup[i]))
{
DestroyDynamicPickup(HousePickup[i]);
}
if(HouseInfo[i][HouseSQLID] > 0)
{
new string[256];
if(HouseInfo[i][HouseOwnerID] == 0)
{
format(string, sizeof(string), "[House]\n\n{00FF00}FOR SALE{FFFFFF}\nPrice: $%s\nType /buyhouse to purchase.", FormatNumber(HouseInfo[i][HouseMarketPrice]), COLOR_LIGHTBLUE >>> 8);
}
else
{
format(string, sizeof(string), "[House]\n\n{FFFFFF}Owner: %s\nLocked: %s", SQLtoNAME(HouseInfo[i][HouseOwnerID]), (HouseInfo[i][HouseLocked] == 1 ? ("Locked") : ("Unlocked")));
}
HouseLabel[i] = CreateDynamic3DTextLabel(string, COLOR_LIGHTBLUE, HouseInfo[i][HouseExteriorX], HouseInfo[i][HouseExteriorY], HouseInfo[i][HouseExteriorZ]+1, 10.0, .testlos = 0, .worldid = HouseInfo[i][HouseExteriorVW], .interiorid = HouseInfo[i][HouseExteriorInt]);
if(HouseInfo[i][HouseOwnerID] == 0)
{
HousePickup[i] = CreateDynamicPickup(1273, 1, HouseInfo[i][HouseExteriorX], HouseInfo[i][HouseExteriorY], HouseInfo[i][HouseExteriorZ], .worldid = HouseInfo[i][HouseExteriorVW], .interiorid = HouseInfo[i][HouseExteriorInt]);
}
else
{
HousePickup[i] = CreateDynamicPickup(1272, 1, HouseInfo[i][HouseExteriorX], HouseInfo[i][HouseExteriorY], HouseInfo[i][HouseExteriorZ], .worldid = HouseInfo[i][HouseExteriorVW], .interiorid = HouseInfo[i][HouseExteriorInt]);
}
}
}
PHP Code:
format(query, sizeof(query), "SELECT * FROM houses");
mysql_function_query(dbhandle, query, true, "OnHouseLoaded", "");
PHP Code:
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_float - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache
[14:03:27] [WARNING] cache_get_field_content - no active cache
[14:03:27] [WARNING] cache_get_field_content_int - no active cache