[ESX] How to save vehicle damage

This is great and works flawlessly!

Is there any way to make it save the physical damage of the vehicle as well?

its not working for me :frowning:

Thanks it works, however trying to get the Body to work too by adding health2 and getVehicleBodyhealth but it doesn’t :frowning:

This damage texture only client side I guess.

Can you give the code?
4 i add that faster?

And can someone say how can i save the vehicles aparance?

how do i get it to work for eden_garage ? i but the

if props.health ~= nil then
SetVehicleEngineHealth(vehicle, props.health+0.00)
end

in essentinal put where do i need to place it in eden_garage

Do I need to edit garages aswell? Anyone has a edited working garage? =)

Wauwie! This works perfect with mine edited esx_advancedgarage, only… i want to save like the broken windows, doors etc? is there a option to add those damage to?

All working, but if i impound the vehicle while engine broken, it gives a 100% health.
If the car was stored while broken then impounded, it willl give 0% health.
How to save the current state of the car, instead of the state when it’s stored?

Installed this three times as stated on the topic but when I load into my server my character spawns as a npc in the middle of no where instead of my own character at my last location? If I take out the code for vehicle health it works fine again.

30 seconds too c+p code and make life easy

5 minutes to take pictures of code post them and claim it works :slight_smile:

Its not working

I have this too, does someone have a new solution?

local vehProps  = ESX.Game.GetVehicleProperties(veh)
local damages	= {
	eng = GetVehicleEngineHealth(veh),
	bod = GetVehicleBodyHealth(veh),
	tnk = GetVehiclePetrolTankHealth(veh),
	drt = GetVehicleDirtLevel(veh),
	oil = GetVehicleOilLevel(veh),
	drvlyt = GetIsLeftVehicleHeadlightDamaged(veh),
	paslyt = GetIsRightVehicleHeadlightDamaged(veh),
	dor = {},
	win = {},
	tyr = {}
}
local vehPos    = GetEntityCoords(veh)
local vehHead   = GetEntityHeading(veh)
for i = 0,5 do
	table.insert(damages.dor, i)
	damages.dor[i] = false
	if not DoesVehicleHaveDoor(veh, i) then
		damages.dor[i] = true
	end
end
for i = 0,13 do
	table.insert(damages.win, i)
	damages.win[i] = false
	if not IsVehicleWindowIntact(veh, i) then
		damages.win[i] = true
	end
end
for i = 0,7 do
	table.insert(damages.tyr, i)
	damages.tyr[i] = false
	if IsVehicleTyreBurst(veh, i, false) then
		damages.tyr[i] = 'popped'
	elseif IsVehicleTyreBurst(veh, i, true) then
		damages.tyr[i] = 'gone'
	end
end```


Won't help implement it, should be pretty self explanatory but THIS 
is what I was looking for when I searched for saving damages. Saves 
damages for tires, windows, and doors. You will need to check against 
this when spawning a car and damage it accordingly.
5 Likes

where put this??

What this?

Where put what?

the code you put

local vehProps = ESX.Game.GetVehicleProperties(veh)
local damages = {
eng = GetVehicleEngineHealth(veh),
bod = GetVehicleBodyHealth(veh),
tnk = GetVehiclePetrolTankHealth(veh),
drt = GetVehicleDirtLevel(veh),
oil = GetVehicleOilLevel(veh),
drvlyt = GetIsLeftVehicleHeadlightDamaged(veh),
paslyt = GetIsRightVehicleHeadlightDamaged(veh),
dor = {},
win = {},
tyr = {}
}
local vehPos = GetEntityCoords(veh)
local vehHead = GetEntityHeading(veh)
for i = 0,5 do
table.insert(damages.dor, i)
damages.dor[i] = false
if not DoesVehicleHaveDoor(veh, i) then
damages.dor[i] = true
end
end
for i = 0,13 do
table.insert(damages.win, i)
damages.win[i] = false
if not IsVehicleWindowIntact(veh, i) then
damages.win[i] = true
end
end
for i = 0,7 do
table.insert(damages.tyr, i)
damages.tyr[i] = false
if IsVehicleTyreBurst(veh, i, false) then
damages.tyr[i] = ‘popped’
elseif IsVehicleTyreBurst(veh, i, true) then
damages.tyr[i] = ‘gone’
end
end```

Won’t help implement it, should be pretty self explanatory but THIS
is what I was looking for when I searched for saving damages. Saves
damages for tires, windows, and doors. You will need to check against
this when spawning a car and damage it accordingly.

this one