i have problem with save car.
when i exp: when i do /v color and change the car color its not update the new color on database
Код:
stock SaveVehicle(vehicleid)
{
if(VehicleInfo[vehicleid][vActive] != true) return 0;
new iQuery[800], iFormat[175];
strcat(iQuery, "UPDATE `VehicleInfo` SET ");
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Owner` = '%e', ", VehicleInfo[vehicleid][vOwner]); strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Model` = %d, ", VehicleInfo[vehicleid][vModel]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Dupekey` = '%e', ", VehicleInfo[vehicleid][vDupekey]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`X` = '%f', ", VehicleInfo[vehicleid][vX]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Y` = '%f', ", VehicleInfo[vehicleid][vY]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Z` = '%f', ", VehicleInfo[vehicleid][vZ]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`A` = '%f', ", VehicleInfo[vehicleid][vA]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`VirtualWorld` = %d, ", VehicleInfo[vehicleid][vVirtualWorld]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Colour1` = %d, ", VehicleInfo[vehicleid][vColour1]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Colour2` = %d, ", VehicleInfo[vehicleid][vColour2]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Paintjob` = %d, ", VehicleInfo[vehicleid][vPaintJob]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`FactionID` = %d, ", VehicleInfo[vehicleid][vFaction]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Reserved` = %d, ", VehicleInfo[vehicleid][vReserved]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Job` = '%e', ", VehicleInfo[vehicleid][vJob]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Business` = %d, ", VehicleInfo[vehicleid][vBusiness]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Sellprice` = %d, ", VehicleInfo[vehicleid][vSellPrice]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Fuel` = %d, ", VehicleInfo[vehicleid][vFuel]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`VehicleGuns` = %d, ", VehicleInfo[vehicleid][vehicleGuns]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`VehicleBullets` = %d, ", VehicleInfo[vehicleid][vehicleBullets]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`HasGunCrates` = %d, ", VehicleInfo[vehicleid][HasGunCrates]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`HasBulletCrates` = %d, ", VehicleInfo[vehicleid][HasBulletCrates]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Stuffs` = %d, ", VehicleInfo[vehicleid][vStuffs]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Guns` = %d, ", VehicleInfo[vehicleid][vGuns]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Alchool` = %d, ", VehicleInfo[vehicleid][vAlchool]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Cars` = %d, ", VehicleInfo[vehicleid][vCars]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Money` = %d, ", VehicleInfo[vehicleid][vMoney]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Oil` = %d, ", VehicleInfo[vehicleid][vOil]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Drugs` = %d, ", VehicleInfo[vehicleid][vDrugs]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Impounded` = %d, ", VehicleInfo[vehicleid][vImpounded]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`ImpoundFee` = %d, ", VehicleInfo[vehicleid][vImpoundFee]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`ImpoundReason` = '%e', ", VehicleInfo[vehicleid][vImpoundReason]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Mileage` = '%f', ", VehicleInfo[vehicleid][vMileage]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Alarm` = %d, ", VehicleInfo[vehicleid][vAlarm]);strcat(iQuery, iFormat);
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Plate` = '%e', ", VehicleInfo[vehicleid][vPlate]);strcat(iQuery, iFormat);
new iSave;
if(VehicleInfo[vehicleid][vRegistered] == true) iSave = 1; else iSave = 0;
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Registered` = %d, ", iSave);
strcat(iQuery, iFormat);
new iString[35];
new tmp[5];
for(new c = 0; c < CAR_COMPONENTS; c++)
{
format(tmp,sizeof(tmp),"%d,", VehicleInfo[vehicleid][vComponents][c]);
strcat(iString,tmp);
}
strdel(iString, strlen(iString)-1, strlen(iString));
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Components` = '%e', ", iString);
strcat(iQuery, iFormat);
for(new c = 0; c < 13; c++)
{
format(tmp,sizeof(tmp),"%d,", VehicleInfo[vehicleid][vWeapon][c]);
strcat(iString,tmp);
}
strdel(iString, strlen(iString)-1, strlen(iString));
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Weapons` = '%e', ", iString);
strcat(iQuery, iFormat);
for(new c = 0; c < 13; c++)
{
format(tmp,sizeof(tmp),"%d,", VehicleInfo[vehicleid][vAmmo][c]);
strcat(iString,tmp);
}
strdel(iString, strlen(iString)-1, strlen(iString));
mysql_format(MySQLPipeline, iFormat, sizeof(iFormat), "`Ammo` = '%e' WHERE `ID` = %d", iString, vehicleid);
strcat(iQuery, iFormat);
mysql_pquery(MySQLPipeline, iQuery);
return 1;
}