[Release] Realistic Vehicle Failure

@jens_s

If you are at a mechanic and you want it to take 10 seconds for the mechanic to fix the vehicle and display a notification that it will take 10 seconds. Add this code below to your client.lua file on around line 174.

Add this:

notification("~g~Please wait 10 seconds while the mechanic is repairing your car!")
Wait(10000)

Should look something like this:

if IsNearMechanic() then
notification("~g~Please wait 10 seconds while the mechanic is repairing your car!")
Wait(10000)
SetVehicleUndriveable(vehicle,false)
SetVehicleFixed(vehicle)
healthBodyLast=1000.0
healthEngineLast=1000.0
healthPetrolTankLast=1000.0
SetVehicleEngineOn(vehicle, true, false )
notification("~g~The mechanic repaired your car!")
return
end

Change the Wait(10000) to whatever number you want the person to wait (Number must be in Millisecond). Also, you can customize the Notification message to your liking.

1 Like

@jens_s, You can add this ^^ message ^^ to the topic if you want :wink:

is the resource starting in the server log? The default command is /repair. You can change this to whatever you want in server.lua on line 26 :wink:

do you know how to fix? “no script guid for vehicle 0 in SET_VEHICLE_HANDLING_FIELD”

No, I dont sorry. I will look into it and see if i can help :slight_smile:

i m unable to repair vehicles by typing /repair vehicle it says you donot have innuff permissions to repair

is there a way to add tire damage multiplier that affects handling ?
so if you pop a steer tire id reduces turning 50% and pulls to whichever side ?
both steer tires and you loose 99% of turning, and same with drive tires, lose 1 and you lose 50% of lateral sliding traction, lose both and you just spin and dont go anywhere and the tail end just slides around. ?
ive been looking into how to add that but have come up emtpy, if someone knows a way please let me know :slight_smile:

Hello, how can I do this after displaying information about the damaged engine, the vehicle does not go further

hello all , need help with car high damage , i didn’t add any script , but when the car hit any thing even with 10km speed , it broke
i have searched in my script and found this :
function Global.SetVehicleAudioEngineDamageFactor(vehicle, damageFactor)
return _in(0x59E7B488451F4D3A, vehicle, damageFactor)
end
Global.N_0x59e7b488451f4d3a = Global.SetVehicleAudioEngineDamageFactor

hello guys, is there anything to stop the engine from turning off then on again after a small bump into an object, im using it for a vRP server :slight_smile:

what do i do to make the visual damage work for the custom add-on cars?
And also i want the actual mechanic be the only one to repair the cars, how do i disable the repair shops?

for some reason the engine wont shut off when we get out of a vehicle. how do we fix this?? even shutting it off doesnt work!

Did you solve it? I have the same problem

I’ve found that if you toggle extras on and off people can repair their vehicle even if its is rendered completely… lets say fucked

Hello i know im late… But is there any chance that i can do a Timer when he is trying to repair his car at a mechanic store?

Hey can someone explain how to set the speed lower when the car is damaged?. Our cars drive now up to 100 km/h, when its fully damaged. And we want them to drive maximum 1-2 km/h

All of my LEO vehicles are flipping like crazy, it only happens with this script. Is there a way for me to fix this without having to edit all of my vehicles handling lines?

So what exactly does the whole “compress and expand” thing mean regarding handling files for config options such as “deformationExponent” and “engineDamageExponent”?

Sorry if stupid question.

I used your example and it almost works perfect (technically it does work exactly as it should for what the change you gave does but…) The problem is that someone can pull up, type the command, they are given the message about waiting, but they can just drive off and once the timer runs out, the repair completes while they are driving down the road. Is there a way for the repair to shut the engine off and then turn it back on once the repair is done?

@TTVResqDiver1317 Maybe add SetVehicleUndrivable(vehicle,false) above the Wait(10000) so it kills the vehicle, waits 10 seconds, then fixes the vehicle :slight_smile: