Code:
SaveVehicleCarToy(carid, toyidx, update) {
if(update) {
format(query, sizeof(query), "UPDATE `playercartoys` SET `X` = %f, `Y` = %f, `Z` = %f, `RX` = %f, `RY` = %f, `RZ` = %f WHERE `id` = %d",VehicleCarToys[carid][toyidx][EVehCarToy_X],VehicleCarToys[carid][toyidx][EVehCarToy_Y],VehicleCarToys[carid][toyidx][EVehCarToy_Z],VehicleCarToys[carid][toyidx][EVehCarToy_RX],VehicleCarToys[carid][toyidx][EVehCarToy_RY],VehicleCarToys[carid][toyidx][EVehCarToy_RZ],VehicleCarToys[carid][toyidx][EVehCarToy_SQLID]);
} else {
format(query, sizeof(query), "INSERT INTO `playercartoys` SET `X` = %f, `Y` = %f, `Z` = %f, `RX` = %f, `RY` = %f, `RZ` = %f, `carid` = %d, `toyidx` = %d",VehicleCarToys[carid][toyidx][EVehCarToy_X],VehicleCarToys[carid][toyidx][EVehCarToy_Y],VehicleCarToys[carid][toyidx][EVehCarToy_Z],VehicleCarToys[carid][toyidx][EVehCarToy_RX],VehicleCarToys[carid][toyidx][EVehCarToy_RY],VehicleCarToys[carid][toyidx][EVehCarToy_RZ],GetVehicleSQLID(carid),VehicleCarToys[carid][toyidx][EVehCarToy_ToyIdx]);
}
mysql_function_query(g_mysql_handle, query, true, "OnSaveCarToy", "ddd", carid, toyidx, update);
}
forward OnSaveCarToy(carid, toyidx, update);
public OnSaveCarToy(carid, toyidx, update) {
new id = mysql_insert_id();
if(!update) {
VehicleCarToys[carid][toyidx][EVehCarToy_SQLID] = id;
}
}
Car Objects aren't saving its position in SQL... can anyone re-check if I am updating it right..
Do I have to debug or smth.... please help thanks.
SQL logs:
Code:
[04:16:49] Passing query INSERT INTO `playercars` (`owner`,`model`,`X`,`Y`,`Z`,`Angle`,`colour1`,`colour2`,`locktype`) VALUES (3945,411,1230.494628,-1654.971801,11.796875,278.702331,4,4,4) | ddddffffdd
[04:16:49] ProcessQueryThread(onPlayerVehicleCreate) - Query was successful. (INSERT INTO `playercars` (`owner`,`model`,`X`,`Y`,`Z`,`Angle`,`colour1`,`colour2`,`locktype`) VALUES (3945,411,1230.494628,-1654.971801,11.796875,278.702331,4,4,4))
[04:16:49] ProcessQueryThread(onPlayerVehicleCreate) - Data caching enabled.
[04:16:49] CMySQLHandler::StoreResult() - No data to store.
[04:16:49] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[04:16:49] onPlayerVehicleCreate(ddddffffdd) - Threaded function called.
[04:16:49] >> mysql_insert_id( Connection handle: 1 )