06.01.2018, 08:00
Your OnGameModeInit code as it is now will not work as you are using the threaded query version of MySQL, you can't use the cache in the same callback as where you send the query.
Try this:
Try this:
Код:
mysql_format(zMySQL, query, sizeof(query), "SELECT * FROM `houses`");
mysql_tquery(zMySQL, query, "LoadHouses");
forward LoadHouses();
public LoadHouses()
{
new numRows;
cache_get_row_count(numRows);
if(numRows == 0) return print("[MYSQL] There are no rows in the houses table.");
else
{
for(new i = 0; i < numRows; i++)
{
cache_get_value_name_float(i, "X", HouseInfo[i][hX]);
cache_get_value_name(i, "owner", HouseInfo[i][hOwner]);
// Add more lines here for each column in houses table
{
if(strcmp(HouseInfo[i][hOwner], "No", true) == 0)
{
HouseInfo[i][hPickup] = CreatePickup(1273, 1, HouseInfo[i][hX], HouseInfo[i][hY], HouseInfo[i][hZ]);
HouseInfo[i][hIcon] = CreateDynamicMapIcon(HouseInfo[i][hX], HouseInfo[i][hY], HouseInfo[i][hZ], 31, 0,0,0);
}
else
{
HouseInfo[i][hPickup] = CreatePickup(19522, 1, HouseInfo[i][hX], HouseInfo[i][hY], HouseInfo[i][hZ]);
HouseInfo[i][hIcon] = CreateDynamicMapIcon(HouseInfo[i][hX], HouseInfo[i][hY], HouseInfo[i][hZ], 32, 0,0,0);
}
}
}
}
}

