10.02.2015, 18:09
(
Последний раз редактировалось norton2; 10.02.2015 в 21:51.
)
I do not update all the cars in the table 'vehicles' in the database! Updates 1st place than my vehicle and then stops!
USE MYSQL R33
Код HTML:
public LoadVehicles() { new tempp[128]; cache_get_data(rows, fields); while(TotalVeh < rows) { cache_get_row(TotalVeh, 0, tempp), VehiclesInfo[TotalVeh][vID] = strval(tempp); cache_get_row(TotalVeh, 1, tempp), VehiclesInfo[TotalVeh][vModel] = strval(tempp); cache_get_row(TotalVeh, 2, tempp), VehiclesInfo[TotalVeh][vPositionX] = floatstr(tempp); cache_get_row(TotalVeh, 3, tempp), VehiclesInfo[TotalVeh][vPositionY] = floatstr(tempp); cache_get_row(TotalVeh, 4, tempp), VehiclesInfo[TotalVeh][vPositionZ] = floatstr(tempp); cache_get_row(TotalVeh, 5, tempp), VehiclesInfo[TotalVeh][vAngle] = floatstr(tempp); cache_get_row(TotalVeh, 6, tempp), VehiclesInfo[TotalVeh][vColor1] = strval(tempp); cache_get_row(TotalVeh, 7, tempp), VehiclesInfo[TotalVeh][vColor2] = strval(tempp); cache_get_row(TotalVeh, 8, tempp), VehiclesInfo[TotalVeh][vPaintJob] = strval(tempp); cache_get_row(TotalVeh, 9, tempp), VehiclesInfo[TotalVeh][vOwner] = strval(tempp); cache_get_row(TotalVeh, 10, tempp), VehiclesInfo[TotalVeh][vLock] = strval(tempp); cache_get_row(TotalVeh, 11, tempp), VehiclesInfo[TotalVeh][vKM] = strval(tempp); cache_get_row(TotalVeh, 12, tempp), VehiclesInfo[TotalVeh][vDays] = strval(tempp); cache_get_row(TotalVeh, 13, tempp), format(VehiclesInfo[TotalVeh][vNumberPlate], 16, tempp); cache_get_row(TotalVeh, 14, tempp), VehiclesInfo[TotalVeh][vComponent1] = strval(tempp); cache_get_row(TotalVeh, 15, tempp), VehiclesInfo[TotalVeh][vComponent2] = strval(tempp); cache_get_row(TotalVeh, 16, tempp), VehiclesInfo[TotalVeh][vComponent3] = strval(tempp); cache_get_row(TotalVeh, 17, tempp), VehiclesInfo[TotalVeh][vComponent4] = strval(tempp); cache_get_row(TotalVeh, 18, tempp), VehiclesInfo[TotalVeh][vComponent5] = strval(tempp); cache_get_row(TotalVeh, 19, tempp), VehiclesInfo[TotalVeh][vComponent6] = strval(tempp); cache_get_row(TotalVeh, 20, tempp), VehiclesInfo[TotalVeh][vComponent7] = strval(tempp); cache_get_row(TotalVeh, 21, tempp), VehiclesInfo[TotalVeh][vComponent8] = strval(tempp); cache_get_row(TotalVeh, 22, tempp), VehiclesInfo[TotalVeh][vComponent9] = strval(tempp); cache_get_row(TotalVeh, 23, tempp), VehiclesInfo[TotalVeh][vComponent10] = strval(tempp); cache_get_row(TotalVeh, 24, tempp), VehiclesInfo[TotalVeh][vComponent11] = strval(tempp); cache_get_row(TotalVeh, 25, tempp), VehiclesInfo[TotalVeh][vComponent12] = strval(tempp); cache_get_row(TotalVeh, 26, tempp), VehiclesInfo[TotalVeh][vComponent13] = strval(tempp); cache_get_row(TotalVeh, 27, tempp), VehiclesInfo[TotalVeh][vComponent14] = strval(tempp); cache_get_row(TotalVeh, 28, tempp), VehiclesInfo[TotalVeh][vComponent15] = strval(tempp); cache_get_row(TotalVeh, 29, tempp), VehiclesInfo[TotalVeh][vComponent16] = strval(tempp); cache_get_row(TotalVeh, 30, tempp), VehiclesInfo[TotalVeh][vComponent17] = strval(tempp); cache_get_row(TotalVeh, 31, tempp), VehiclesInfo[TotalVeh][vServerID] = strval(tempp); cache_get_row(TotalVeh, 32, tempp), VehiclesInfo[TotalVeh][vSlot] = strval(tempp); TotalVeh++; } new query[512]; mysql_format(handle, query, 1024, "SELECT * FROM `vehicles`"); mysql_tquery(handle, query, "OnVehID", "i", TotalVeh); printf("%d total vehicles",TotalVeh); return 1; }
Код HTML:
forward OnVehID();
public OnVehID()
{
new query[254];
//VehiclesInfo[entry][vID] = cache_insert_id(); // here, we set the vehicle id in this variable, and the mysql VID field, which we're gonna add later.
for(new i = 0; i < sizeof(VehiclesInfo); i++)
{
VehiclesInfo[i][vServerID] = CreateVehicle(VehiclesInfo[i][vModel],VehiclesInfo[i][vPositionX],VehiclesInfo[i][vPositionY],VehiclesInfo[i][vPositionZ],VehiclesInfo[i][vAngle],VehiclesInfo[i][vColor1],VehiclesInfo[i][vColor2],60000);
mysql_format(handle, query, sizeof(query), "UPDATE `vehicles` SET `ServerID` = '%i' WHERE ID = '%i'", VehiclesInfo[i][vServerID], VehiclesInfo[i][vID]);
mysql_query(handle, query);
if(i > MotoCros[20])
{
Tunen(i);
}
}
}