31.05.2020, 08:01
I have created a dynamic vehicle system that allows me to create vehicles around the map just by a command, so far it saves the vehicles into the table but i'm not sure how am i supposed to load it. I haven't been making any dynamic systems so far rather than accounts but i think im learning it so far. Here's the code i've tried:
Then i just do LoadVehicles(); under OnGameModeInit.
Code:
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; }