Loading only one vehicle from the database.
#1

I made this script so it spawns all vehicles from the database, but it only spawns the first car in the database.

This is my OnGamemodeInit.

Код:
	mysql_format(mysql, query, sizeof(query), "SELECT * FROM `vehicles`");
	mysql_tquery(mysql, query, "OnCarsLoad");
This is my OnCarsLoad.

Код:
public OnCarsLoad(vehicleid)
{
	new tmp[256], string5[256];
	cInfo[vehicleid][cModel] = cache_get_field_content_int(0, "carModel");
	cInfo[vehicleid][cPosX] = cache_get_field_content_float(0, "carPosX");
	cInfo[vehicleid][cPosY] = cache_get_field_content_float(0, "carPosY");
	cInfo[vehicleid][cPosZ] = cache_get_field_content_float(0, "carPosZ");
	cInfo[vehicleid][cPosF] = cache_get_field_content_float(0, "carPosF");
	cInfo[vehicleid][cGroup] = cache_get_field_content_int(0, "carGroup");
	cInfo[vehicleid][cVW] = cache_get_field_content_int(0, "carVirtualWorld");
	cInfo[vehicleid][cColor1] = cache_get_field_content_int(0, "carColor1");
	cInfo[vehicleid][cColor2] = cache_get_field_content_int(0, "carColor2");
	cache_get_field_content(0, "carPlate", tmp, mysql), cInfo[vehicleid][cPlate] = strval(tmp);
	CreateVehicle(cInfo[vehicleid][cModel], cInfo[vehicleid][cPosX], cInfo[vehicleid][cPosY], cInfo[vehicleid][cPosZ], cInfo[vehicleid][cPosF], cInfo[vehicleid][cColor1], cInfo[vehicleid][cColor2], -1);
	SetVehicleVirtualWorld(vehicleid, cInfo[vehicleid][cVW]);
	SetVehicleNumberPlate(vehicleid, cInfo[vehicleid][cPlate]);
	vCount++;
	format(string5, sizeof(string5), " %d cars loaded from database.", vCount);
	print(string5);
	return 1;
}
Reply


Messages In This Thread
Loading only one vehicle from the database. - by danielpalade - 16.01.2016, 12:44
Re: Loading only one vehicle from the database. - by Vince - 16.01.2016, 13:10
Re: Loading only one vehicle from the database. - by danielpalade - 16.01.2016, 13:17
Re: Loading only one vehicle from the database. - by PrO.GameR - 16.01.2016, 13:55
Re: Loading only one vehicle from the database. - by PatrickGTR - 16.01.2016, 14:17
Re: Loading only one vehicle from the database. - by danielpalade - 16.01.2016, 14:51

Forum Jump:


Users browsing this thread: 1 Guest(s)