LoadVehicles() { new query[1000], vehiclecolor1, vehiclecolor2, Float:vehiclex, Float:vehicley, Float:vehiclez, Float:vehiclea; mysql_format(mysql_handle, query, sizeof(query), "SELECT * FROM `vehicles` WHERE `vehmodel` = %d, `vehcolor1` = %d, `vehcolor2` = %d, `veh_x` = %f, `veh_y` = %f, `veh_z` = %f, `veh_a` = %f ", vehicledata[vehicleid2][vehmodel], vehicledata[vehicleid2][vehcolor1], vehicledata[vehicleid2][vehcolor2], vehicledata[vehicleid2][veh_x], vehicledata[vehicleid2][veh_y], vehicledata[vehicleid2][veh_z], vehicledata[vehicleid2][veh_a]); mysql_tquery(mysql_handle, query); for(new v = 0; v < sizeof(vehicleid2); v++) { vehiclemodel = vehicledata[v][vehmodel]; vehiclecolor1 = vehicledata[v][vehcolor1]; vehiclecolor2 = vehicledata[v][vehcolor2]; vehiclex = vehicledata[v][veh_x]; vehicley = vehicledata[v][veh_y]; vehiclez = vehicledata[v][veh_z]; vehiclea = vehicledata[v][veh_a]; CreateVehicle(vehiclemodel, vehiclex, vehicley, vehiclez, vehiclea, vehiclecolor1, vehiclecolor2, -1, 0); } return 1; }
public OnGameModeInit() { new query[1000], vehiclecolor1, vehiclecolor2, Float:vehiclex, Float:vehicley, Float:vehiclez, Float:vehiclea; mysql_format(mysql_handle, query, sizeof(query), "SELECT * FROM `vehicles` WHERE `vehmodel` = %d, `vehcolor1` = %d, `vehcolor2` = %d, `veh_x` = %f, `veh_y` = %f, `veh_z` = %f, `veh_a` = %f ", vehicledata[vehicleid2][vehmodel], vehicledata[vehicleid2][vehcolor1], vehicledata[vehicleid2][vehcolor2], vehicledata[vehicleid2][veh_x], vehicledata[vehicleid2][veh_y], vehicledata[vehicleid2][veh_z], vehicledata[vehicleid2][veh_a]); mysql_tquery(mysql_handle, query);
mysql_tquery(mysql_handle, query);
mysql_tquery(mysql_handle, query, "LoadVehicles", "");
forward LoadVehicles(); public LoadVehicles() { for(new v = 0; v < sizeof(vehicleid2); v++) { vehiclemodel = vehicledata[v][vehmodel]; vehiclecolor1 = vehicledata[v][vehcolor1]; vehiclecolor2 = vehicledata[v][vehcolor2]; vehiclex = vehicledata[v][veh_x]; vehicley = vehicledata[v][veh_y]; vehiclez = vehicledata[v][veh_z]; vehiclea = vehicledata[v][veh_a]; CreateVehicle(vehiclemodel, vehiclex, vehicley, vehiclez, vehiclea, vehiclecolor1, vehiclecolor2, -1, 0); } return 1; }
[11:18:22] [plugins/mysql] error #1064 while executing query "SELECT * FROM `vehicles` WHERE `vehmodel` = 0, `vehcolor1` = 0, `vehcolor2` = 0, `veh_x` = 0.000000, `veh_y` = 0.000000, `veh_z` = 0.000000, `veh_a` = 0.000000 ": You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' `vehcolor1` = 0, `vehcolor2` = 0, `veh_x` = 0.000000, `veh_y` = 0.000000, `veh_' at line 1 [11:18:22] [log-core] exception 0XC0000005 (ACCESS_VIOLATION) from Vectored Exception Handler catched; shutting log-core down
SELECT * FROM `vehicles` WHERE `vehmodel` = 0 AND `vehcolor1` = 0 AND...
The proper way to write it using SQL is to use "AND" and not using commas.
Code:
SELECT * FROM `vehicles` WHERE `vehmodel` = 0 AND `vehcolor1` = 0 AND... |
`vehmodel` = 0 |
Show the whole thing you've got. Anyways, if you try to load using this query, you won't see anything for sure, gta sa modelids range from 400 to 600 smth, won't load anything
|
The code you've written. If you copy pasted what I wrote above you won't get anything, as there's no cache_get function at all.
|
But i assume it would work since there are functions from where i can get values from the vehicles that are saved in the table. |