I’m making a script for the mechanics. My idea is that all the different damage to the car should be repaired with one item. If the engine is broken, you fix it with one item or if the windows are broken, you fix it with another item. I have managed to solve all parts of the cars except the body.
What are you trying to persist after repair? If engine and other types of damage you can always capture these first and then set them back to the vehicle after you run the SetVehicleFixed(vehicle)
Something like this if you’re trying to persist the engine and gas tank health values. If you’re trying to persist windows you can check for these if they are broken, save them, and then rebreak them, same with doors, however I’m not sure there is a native that will just fix single doors (maybe you can educate me on that). I also didn’t consider maybe using the vehicle mod to fix the hood and bumpers, that could also be an option if it works to avoid using SetVehicleFixed.
local engineHealth = GetVehicleEngineHealth(vehicle)
local petrolHealth = GetVehiclePetrolTankHealth(vehicle)
SetVehicleFixed(vehicle)
SetVehicleEngineHealth(vehicle, engineHealth)
SetVehiclePetrolTankHealth(vehicle, petrolHealth)