mysql vehicle loading issue
#2

The way you wrote it is wrong already.

The way you should do it is:
1. Have the top part under OnGameModeInit:
Code:
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);
2. However as you can see, nothing will be called, so we have to turn
Code:
mysql_tquery(mysql_handle, query);
into
Code:
mysql_tquery(mysql_handle, query, "LoadVehicles", "");
3. In order for this change to work, you have to forward and public LoadVehicles:
Code:
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;
}
!! THIS CODE WON'T WORK, you have to apply the changes accordingly, it is just a canvas.
Reply


Messages In This Thread
mysql vehicle loading issue - by Mike861 - 31.05.2020, 08:01
Re: mysql vehicle loading issue - by Adamoneoone - 31.05.2020, 09:08
Re: mysql vehicle loading issue - by Mike861 - 31.05.2020, 09:16
Re: mysql vehicle loading issue - by Adamoneoone - 31.05.2020, 09:26
Re: mysql vehicle loading issue - by Mike861 - 31.05.2020, 09:28
Re: mysql vehicle loading issue - by Adamoneoone - 31.05.2020, 09:30
Re: mysql vehicle loading issue - by Mike861 - 31.05.2020, 09:38
Re: mysql vehicle loading issue - by Adamoneoone - 31.05.2020, 09:41
Re: mysql vehicle loading issue - by Mike861 - 31.05.2020, 09:45
Re: mysql vehicle loading issue - by Adamoneoone - 31.05.2020, 10:49

Forum Jump:


Users browsing this thread: 2 Guest(s)