16.11.2014, 10:11
So my dealership save only vehicles which are tuned in the normal GTA Tune Garages [SF/LS] but im trying to make this cmd to save also the vehicle mods.
Im trying this to make it to work, i have dialog for tune but it not save the tune.
pawn Код:
UpdateVehicle(vehicleid, removeold)
{
if(VehicleCreated[vehicleid])
{
if(removeold)
{
new Float:health;
GetVehicleHealth(VehicleID[vehicleid], health);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(VehicleID[vehicleid], engine, lights, alarm, doors, bonnet, boot, objective);
//new panels, doorsd, lightsd, tires;
//GetVehicleDamageStatus(VehicleID[vehicleid], panels, doorsd, lightsd, tires);
DestroyVehicle(VehicleID[vehicleid]);
VehicleID[vehicleid] = CreateVehicle(VehicleModel[vehicleid], VehiclePos[vehicleid][0], VehiclePos[vehicleid][1],
VehiclePos[vehicleid][2], VehiclePos[vehicleid][3], VehicleColor[vehicleid][0], VehicleColor[vehicleid][1], 3600);
SetVehicleHealth(VehicleID[vehicleid], health);
SetVehicleParamsEx(VehicleID[vehicleid], engine, lights, alarm, doors, bonnet, boot, objective);
//UpdateVehicleDamageStatus(VehicleID[vehicleid], panels, doorsd, lightsd, tires);
}
else
{
VehicleID[vehicleid] = CreateVehicle(VehicleModel[vehicleid], VehiclePos[vehicleid][0], VehiclePos[vehicleid][1],
VehiclePos[vehicleid][2], VehiclePos[vehicleid][3], VehicleColor[vehicleid][0], VehicleColor[vehicleid][1], 3600);
}
LinkVehicleToInterior(VehicleID[vehicleid], VehicleInterior[vehicleid]);
SetVehicleVirtualWorld(VehicleID[vehicleid], VehicleWorld[vehicleid]);
SetVehicleNumberPlate(VehicleID[vehicleid], VehicleNumberPlate[vehicleid]);
for(new i=0; i < sizeof(VehicleMods[]); i++)
{
AddVehicleComponent(VehicleID[vehicleid], VehicleMods[vehicleid][i]);
}
ChangeVehiclePaintjob(VehicleID[vehicleid], VehiclePaintjob[vehicleid]);
if(VehicleLock[vehicleid]) ToggleDoors(VehicleID[vehicleid], VEHICLE_PARAMS_ON);
if(VehicleAlarm[vehicleid]) VehicleSecurity[VehicleID[vehicleid]] = 1;
UpdateVehicleLabel(vehicleid, removeold);
}
}
pawn Код:
new id = GetVehicleID(vehicleid);
if(IsValidVehicle(id))
{
VehicleMods[id][GetVehicleComponentType(componentid)] = componentid;
SaveVehicle(id);
}
return 1;
}
Im trying this to make it to work, i have dialog for tune but it not save the tune.
pawn Код:
if(dialogid == 1113 && response)
{
if(listitem == 17) return CarmodDialog(playerid);
new Warray[] = {1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1096,1097,1098,1079};
//AddVehcleComponent(vehid,Warray[listitem]);
new vehicleid = GetPlayerVehicleID(playerid);
AddVehicleComponent(VehicleID[vehicleid], Warray[listitem]);
//AddVehicleComponent(VehicleID[vehicleid], VehicleMods[vehicleid][listitem]);
new id = GetVehicleID(vehicleid);
VehicleMods[id][GetVehicleComponentType(vehmd)] = vehmd;
SaveVehicle(id);
return CarmodDialog(playerid);
}