Fix Body for cars (Mechanics)

Hi.

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.

I use these natives

SetVehicleDeformationFixed(vehicle)
SetVehicleBodyHealth(vehicle, 1000.0)

But it does not solve the scratches on the car or the broken headlights as the picture below.

I do not want to use SetVehicleFixed(vehicle) because it fixes the whole car and ruins my idea for this script.

Does anyone have any idea what I can do to solve this?

/Calm

1 Like

Could try this native:

Thanks for the answer, unfortunately this native does not work for what I am looking for.

Try this one maybe. It’s what I use on my carwash script

I tried WashDecalsFromVehicle it did not work :frowning:

I add this video so it makes more sense

You can use these, they fix the deformation and the scratches but they will not fix things like the hood and bumpers being loose or completely off.

    SetVehicleDeformationFixed(vehicle)
    RemoveDecalsFromVehicle(vehicle)

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)

4 Likes

Hi thanks it worked :slight_smile:

But as you said bumpers and hood are not being fixed.

Can you give me an example how to capture the damage and then apply it after 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)
4 Likes

Big thanks to you!

I will try this. This should work, I will mark your comment as the solution.

I solved it with your tips. Thanks so much! :slight_smile:

https://streamable.com/27ugtv

Will check if it is possible to solve the doors tomorrow.
But I think I will solve it with these two natives

IsVehicleDoorDamaged and SetVehicleDoorBroken