14.06.2015, 11:15
How is it supposed to know how many times it will loop if you don't execute the query before?
Anyway, I see no point on using non-threaded queries as they are slower and especially when having many rows:
and modify this line:
and the size you have in the enum for HouseText.
Anyway, I see no point on using non-threaded queries as they are slower and especially when having many rows:
pawn Код:
mysql_tquery(1, "SELECT * FROM houses", "OnHousesLoad", "");
PHP код:
forward OnHousesLoad();
public OnHousesLoad()
{
for(new x, j = cache_get_row_count(); x != j; ++x)
{
if (x >= sizeof HouseInfo) break; // prevent any out of bounds run time error
HouseInfo[x][HouseID] = cache_get_field_content_int(x, "id");
HouseInfo[x][EntranceX] = cache_get_field_content_float(x, "EntranceX");
HouseInfo[x][EntranceY] = cache_get_field_content_float(x, "EntranceY");
HouseInfo[x][EntranceZ] = cache_get_field_content_float(x, "EntranceZ");
HouseInfo[x][ExitX] = cache_get_field_content_float(x, "ExitX");
HouseInfo[x][ExitY] = cache_get_field_content_float(x, "ExitY");
HouseInfo[x][ExitZ] = cache_get_field_content_float(x, "ExitZ");
HouseInfo[x][InsideInt] = cache_get_field_content_int(x, "InsideInt");
cache_get_field_content(x, "owner", HouseInfo[x][owner], 1, MAX_PLAYER_NAME);
HouseInfo[x][owned] = cache_get_field_content_int(x, "owned");
HouseInfo[x][HousePrice] = cache_get_field_content_int(x, "price");
cache_get_field_content(x, "text", HouseInfo[x][HouseText], 1, /* SIZE OF HouseText HERE */);
Create3DTextLabel(HouseInfo[x][HouseText], COLOR_GREEN, HouseInfo[x][EntranceX], HouseInfo[x][EntranceY], HouseInfo[x][EntranceZ], 30, 0, 1);
}
return 1;
}
pawn Код:
cache_get_field_content(x, "text", HouseInfo[x][HouseText], 1, /* SIZE OF HouseText HERE */);