11.10.2016, 09:07
This is not a good way to load the data. Send only a single query and use a loop. Plus an extra variable for the ID so instead of the array index, you will have a way to recognize in the database. An example:
As for the initial issue, I took a look at your code but didn't notice anything. Debug it as:
PHP код:
Plants_Load()
{
new DBResult: dbresult = db_query(database, "SELECT * FROM plants ORDER BY id");
for (new i, j = db_num_rows(dbresult); i != j; i++)
{
PlantInfo[i][plantID] = db_get_field_assoc_int(dbresult, "id");
PlantInfo[i][plantType] = db_get_field_assoc_int(dbresult, "type");
PlantInfo[i][plantDrugs] = db_get_field_assoc_int(dbresult, "drugs");
PlantInfo[i][plantPos][0] = db_get_field_assoc_float(dbresult, "x");
PlantInfo[i][plantPos][1] = db_get_field_assoc_float(dbresult, "y");
PlantInfo[i][plantPos][2] = db_get_field_assoc_float(dbresult, "z");
PlantInfo[i][plantPos][3] = db_get_field_assoc_float(dbresult, "a");
PlantInfo[i][plantInterior] = db_get_field_assoc_int(dbresult, "interior");
PlantInfo[i][plantWorld] = db_get_field_assoc_int(dbresult, "world");
PlantInfo[i][plantExists] = true;
ServerInfo[total_plants]++;
Plant_Refresh(i);
db_next_row(dbresult)
}
db_free_result(dbresult);
}
pawn Код:
// loading plants
// print message
// loading dealership
// print message
// loading dealership vehicles
// print message
// and so on..