17.05.2012, 04:07
ok, try it;
I assumed that you named your variables HD[i]["name"] with the same column name in to your table, if don't, just rename it.
if it won't work, debug the variable "rows" and see if it is returning something bigger than 0.
pawn Код:
LoadHouses() {
new Query[70], temp[50], i;
format(Query, sizeof(Query), "SELECT * FROM houses");
mysql_query(Query);
mysql_store_result();
CheckMySQL();
while(mysql_fetch_row(Query)){
mysql_fetch_field_row(HD[i][owner], "owner");
mysql_fetch_field_row(HD[i][hname], "hname");
mysql_fetch_field_row(temp, "ID"); HD[i][ID] = strval(temp);
mysql_fetch_field_row(temp, "hprice"); HD[i][hprice] = strval(temp);
mysql_fetch_field_row(temp, "exteriorX"); HD[i][exteriorX] = floatstr(temp);
mysql_fetch_field_row(temp, "exteriorY"); HD[i][exteriorY] = floatstr(temp);
mysql_fetch_field_row(temp, "exteriorZ"); HD[i][exteriorZ] = floatstr(temp);
mysql_fetch_field_row(temp, "interiorX"); HD[i][interiorX] = floatstr(temp);
mysql_fetch_field_row(temp, "interiorY"); HD[i][interiorY] = floatstr(temp);
mysql_fetch_field_row(temp, "interiorZ"); HD[i][interiorZ] = floatstr(temp);
mysql_fetch_field_row(temp, "interiorInt"); HD[i][interiorInt] = strval(temp);
mysql_fetch_field_row(temp, "locked"); HD[i][locked] = strval(temp);
mysql_fetch_field_row(temp, "gunslot1"); HD[i][gunslot1] = strval(temp);
mysql_fetch_field_row(temp, "locklevel"); HD[i][locklevel] = strval(temp);
mysql_fetch_field_row(temp, "safemount"); HD[i][safemount] = strval(temp);
if(strlen(HD[i][owner]) > 0) CreatePickup(1273, 1, HD[i][exteriorX], HD[i][exteriorY], HD[i][exteriorZ], -1);
else CreatePickup(1273, 1, HD[i][exteriorX], HD[i][exteriorY], HD[i][exteriorZ], -1);
Create3DTextLabel(HD[i][hname], 0x000000AA, HD[i][exteriorX], HD[i][exteriorY], HD[i][exteriorZ], 5.0, 0);
printf("House %d spawned @ %f, %f, %f", i, HD[i][exteriorX], HD[i][exteriorY], HD[i][exteriorZ]);
++i;
}
mysql_free_result();
}
if it won't work, debug the variable "rows" and see if it is returning something bigger than 0.

