18.01.2016, 16:36
Alright so the problem is simple
The problem is it will display result for this like
For all cars it says ID:0
EDIT: I just added printf("%i",VehInfo[x][VID]); infront of all of it and it printed out all ID's correctly. But problem remains.
PHP код:
SaveAllCars() {
new VehiclesSaved = 0;
for(new x = 0; x < MAX_VEHICLES; x++) {
if(IsValidVehicle(x)) {
new Float:tmpStatus;
GetVehicleHealth(x,tmpStatus);
new query[1512] = "UPDATE `vehicles` SET `Color1`=%i,`Color2`=%i";
strcat(query,",`Damage`=%f,`FuelStatus`=%i,`EngineStatus`=%i,`Kilometrage`=%f,`FactionID`=%i,\
`Locked`=%i,`TrunkSlot1`=%i,`Plates`='%e',`Windows`=%i");
strcat(query,",`GloveboxWeapon`=%i,`GloveboxWeaponAmmo`=%i,\
`TrunkWeapon1`=%i,`TrunkWeapon1Ammo`=%i,`TrunkWeapon2`=%i,`TrunkWeapon2Ammo`=%i,`TrunkWeapon3`=%i,\
`TrunkWeapon3Ammo`=%i WHERE `ID`=%d");
format(query, sizeof(query), query, VehInfo[x][Color1],VehInfo[x][Color2],
tmpStatus,VehInfo[x][FuelStatus],VehInfo[x][EngineStatus],
VehInfo[x][Kilometrage],VehInfo[x][VehFaction],VehInfo[x][VLock],VehInfo[x][VehTrunkSlot1],VehInfo[x][VehPlate],
VehInfo[x][VehWindows],VehInfo[x][GloveboxWeapon],VehInfo[x][GloveboxWeaponAmmo],
VehInfo[x][TrunkSlot1Weapon],VehInfo[x][TrunkSlot1WeaponAmmo],
VehInfo[x][TrunkSlot2Weapon],VehInfo[x][TrunkSlot2WeaponAmmo],
VehInfo[x][TrunkSlot3Weapon],VehInfo[x][TrunkSlot3WeaponAmmo],VehInfo[x][VID]);
mysql_tquery(mysql, query, "", "");
VehiclesSaved++;
print(query);
}
}
MsgToAll(COLOR_RED,"[!A] All vehicles have been saved");
printf("Total of %i vehicles saved",VehiclesSaved);
return true;
}
PHP код:
[18:35:14] UPDATE `vehicles` SET `Color1`=1,`Color2`=0,`Damage`=1000.000000,`FuelStatus`=100,`EngineStatus`=0,`Kilometrage`=0.000000,`FactionID`=0,`Locked`=0,`TrunkSlot1`=0,`Plates`='e',`Windows`=48,`GloveboxWeapon`=0,`GloveboxWeaponAmmo`=24,`TrunkWeapon1`=100,`TrunkWeapon1Ammo`=0,`TrunkWeapon2`=0,`TrunkWeapon2Ammo`=0,`TrunkWeapon3`=0,`TrunkWeapon3Ammo`=0 WHERE `ID`=0
EDIT: I just added printf("%i",VehInfo[x][VID]); infront of all of it and it printed out all ID's correctly. But problem remains.