[Release] Realistic Vehicle Failure



Great work.

May I use this is my pack & make it vRP friendly?


I can tell you exactly which API’s I manipulate, to help you determine if my script is the culprit:

  • I Add blips for mechanics, if enabled
  • I call SetVehicleUndriveable
  • I call SetVehicleFixed
  • I call SetVehicleEngineOn
  • I change the value of VehicleEngineHealth
  • I change the value of VehicleBodyHealth
  • I change the value of VehiclePetrolTankHealth
  • I change the value of VehicleOilLevel

I change the vehicle handling when entering or exiting the vehicle:

  • fDeformationDamageMult
  • fWeaponDamageMult
  • fCollisionDamageMult

And in the next version (coming soon) I also change the VehicleEngineTorqueMultiplier and disable the steering in a certain situation.

I think that’s it.
If your custom handling files rely on any of those values, there may be a conflict.


Thanks :slight_smile:
Yes, please do. This is open source, released as Creative Commons CC-BY-SA
You may do just about anything you want with this script, as long as you give credit, and don’t release it under a different license.


I have explored the idea you gave me, and found that if I modify the torque multiplier, and you also modify it using a trainer, the trainer seems to be overriding my script. That’s good news, because then I don’t take away the choice from the user.
Next version will slow down the vehicles progressively as they get damaged.

Thanks for the suggestion.


New version released

Version 0.5 adds the following new features and fixes:

  • Moved config to a separate file for easier updating
  • Prevents flipping an upside down car over
  • Vehicle will progressively slow down as damage increases
  • Balanced the damage and visual damage to be more consistent across vehicle classes and types
  • Changes to handling values are now multiplied from existing values instead of just setting values. Preserves the differences between vehicles more (ie. armoured cars should be somewhat tough)
  • Damage multiplier can be set for each vehicle class separately
  • Fix for not resetting handling while exiting the vehicle

Get it at GitHub using the link in the original post. Let me know if you find any problems or have other suggestions.



@jens_s Love this script! Thank you for making it. I noticed a bit of a bug when using Basic Vehicle Actions. BVA allows the engine to be shut-off and when it’s shut-off the vehicle takes damage. Any way to remedy this or has it already been resolved with the latest update? Thanks again!


Just so you know if you dont, the damage isnt synced for other players, if i wreck my car, the other players dont see the damage.


I have tried BVA and been able to reproduce the problem.
Turns out that BVA sets the fuel tank health to zero when you turn off the car. That is very bad behaviour. Here’s why:

  1. Disable my script
  2. Spawn a new healthy car
  3. Turn off the engine with BVA
  4. Get out of the car
  5. Shoot at the fuel tank
  6. Kaboom!

Takes only one shot, maybe two.

So even by itself BVA has a problem with explosions, but the same bug or bad implementation is what causes my script to register huge damage to the fuel tank, rendering the vehicle inoperable.

Thanks for reporting this. Being somewhat of a hermit, I haven’t tested the multiplayer functionality myself.

I believe that the way GTA Online and thus FiveM syncs players doesn’t really sync visual damage very well.
Having watched youtube videos like for example the Code Zero guys, it’s quite obvious that the damage to a specific vehicle looks different to each player. “Not on my screen” is a phrase heard quite often.
Hopefully the OneSync project does a better job.

In the meantime, I will disable the visual damage modifier in the default config, and add a note that it doesn’t sync if enabled.


Sweet, great script nevertheless, thanks for the release!


New version released

Version 0.6 adds the “Sunday Driver” feature.

While I realize that this feature isn’t very related to damage and failure, I decided to include it anyway, since releasing it as a separate script would create a conflict between the two scripts. I still plan to release it separately later.

So, what is it?

It enables very smooth acceleration and braking, and also makes it much easier to drive at a steady pace at lower speeds.
The smooth acceleration is achieved by manipulating the engine torque multiplier relative to the throttle position.
(For controllers, has no effect when using keyboard)

Smooth braking is achieved by manipulation the brake force handling line relative to the brake pressure.
(For controllers, has no effect when using keyboard)

You can still accelerate at full speed and brake at full force by pressing the triggers all the way.

On top of that it also disables the reversing when the vehicle comes to a stop and also eliminates the reversing lights coming on when stopping. To brake and then reverse, you need to release the brake completely first.

When the vehicle comes to a complete stop keep on braking to hold the vehicle with the brake lights on. Release the brake to turn off the brake lights.


It looks so much better if you are able to accelerate, brake and drive smoothly. Just try keeping a steady 35 mph in the city without this script. Nearly impossible. With this script it’s a lot easier. Try it and compare.

The brake-light mods I have seen keeps the brake lights on at all time when the vehicle is not moving. That’s a problem if you’re trying for example to escape the police by turning off your lights and hiding behind a bush.

If you attempt to mimic AI you will often give yourself away when the reversing lights flash briefly when coming to a stop. Not so anymore.


Hope this makes sense. If not, changing “sundayDriver = true” to “sundayDriver = false” in config.lua will disable this feature.

Get it at GitHub using the link in the original post. Let me know if you find any problems or have other suggestions.



what a great update. The idea of having to almost shift into reverse by releasing the brake first is awesome. It adds realism a bit in my opinion just based on the time factor. That coupled with the brake lights is perfect.


Great idea, I will be testing this :smiley:


i did try myself for the script, but i stamped one time on a motor, and motor was disabled…


I am unable to replicate the problem, except for one case: If the vehicle is badly damaged, but barely alive, stomping, kicking, hitting or shooting the vehicle will kill the engine. That’s by design.

If you are using an older version, there were some problems that should be fixed by now.

If you are still having problems with the newest version, please describe step by step what I need to do to reproduce the problem. That will help me a lot.


Just a quick note to developers modifying my script:
When you restart the script there’s a risk that the current vehicle behaves oddly afterwards.
Either get out of the car before restarting, or spawn a new cars after.

It’s not easily solved, so I’m not going to :wink:

Here’s the reason:

  1. When you get into a car, I save the default values of some handling.meta fields.
  2. While you’re driving I modify the handling.meta values, based on those saved default values
  3. When getting out of the car, I restore the default values.

If you restart the script while at step two, we jump straight to step one. Now those default values are actually the modified values. That gives some weird behavior.


Still can’t find that sweet spot I tried the numbers both ways… Head on into a wall at 80mph should totally destroy a prius. What do you recommend?


Are you planning any new features ?


If you increase the damagefactors, the car will sustain more damage. To totally destroy a Dilettante at 80 mph these values will do the trick. Haven’t had time to test other cars, so some may damage too easily and other may still be too tough.

	damageFactorEngine = 16.0
	damageFactorBody = 16.0
	damageFactorPetrolTank = 150.0

Some cars are more sensitive to engine damage, others to body damage, and still other to fuel tank damage.
It seems like fuel tank (called Petrol Tank to be consistent with the game code) is the most consistent across vehicles. More testing needed.

Two planned, when time permits:

  1. Better default values in config. Perhaps the option to choose from a few presets, since no setting will be perfect for every user.
  2. Limp mode: If enabled the car will never destroy completely, but will be able to drive slowly to the nearest mechanic.


Odd my current settings are:
damageFactorEngine = 80.0, – Sane values are 1 to 100. Higher values means more damage to vehicle. A good starting point is 10
damageFactorBody = 85.0, – Sane values are 1 to 100. Higher values means more damage to vehicle. A good starting point is 10
damageFactorPetrolTank = 60.0,

I was hitting headon with Semis, walls, guard rails. it ran out of fuel before becoming destroyed. I don’t get it.

PS I don’t have any other vehicle damage scripts running not even a hud. I took that out to see if it was the issue. Still no good after a clear and restart.


That sounds like the script isn’t even active.

I can think of a couple of scenarios where this might happen:

1: The script has crashed
2: One or more of your settings are causing it to ignore the damage settings.

First off, if you have enabled the Sunday Driver feature, drive forward, then brake, and keep on braking and see if the car is standing still after stopping. If it goes into reverse by itself, the script is not running for some reason.

The second point is related to my laziness… I haven’t implemented checks for incorrect settings (yet). If you set some of the config settings to an integer where a floating point value is expected, FiveM will “ignore” some native calls.
For example a value of 10 may not work, while 10.0 will work. The settings you showed here looks fine, but other settings may be bad. It’s an easy mistake to make.
(I am confused as to why this happens since lua should handle ints and floats the same, but it may be related to the way calls are made to the native functions. If anyone knows how to handle this, please let me know)

If you comment out some of the settings (Thinking you don’t want or need them), the script will probably crash.

Also remember that you should not reload the script while in a car, since that may cause weird behavior. If you do, just spawn or steal a new car before testing.

If all else fails, send all your settings to me in a PM, and I will try them out here.

Update: Settings were fine, a reinstall of FiveM fixed the problems.