mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-30 17:58:54 +00:00
See description for changes
Fixed the "health" problems on vehicles. It seems like you shouldn't use the `GetEntityHealth()` on vehicles at all since it is linked to the `GetVehicleBodyHealth()` native. But if you use the `SetEntityHealth()` native on an vehicle it breaks the link. Instead there's both body health and engine health that ESX has missed out on. Since the new used `GetVehicle***` natives return decimal values we round them to 1 decmial. Also dirt levels are now rounded to one decimal since they make 0 visable difference.
This commit is contained in:
@@ -638,15 +638,15 @@ ESX.Game.GetVehicleProperties = function(vehicle)
|
||||
end
|
||||
|
||||
return {
|
||||
|
||||
model = GetEntityModel(vehicle),
|
||||
|
||||
plate = ESX.Math.Trim(GetVehicleNumberPlateText(vehicle)),
|
||||
plateIndex = GetVehicleNumberPlateTextIndex(vehicle),
|
||||
|
||||
health = GetEntityHealth(vehicle),
|
||||
dirtLevel = GetVehicleDirtLevel(vehicle),
|
||||
bodyHealth = ESX.Math.Round(GetVehicleBodyHealth(vehicle), 1),
|
||||
engineHealth = ESX.Math.Round(GetVehicleEngineHealth(vehicle), 1),
|
||||
|
||||
dirtLevel = ESX.Math.Round(GetVehicleDirtLevel(vehicle), 1),
|
||||
color1 = color1,
|
||||
color2 = color2,
|
||||
|
||||
@@ -731,8 +731,12 @@ ESX.Game.SetVehicleProperties = function(vehicle, props)
|
||||
SetVehicleNumberPlateTextIndex(vehicle, props.plateIndex)
|
||||
end
|
||||
|
||||
if props.health ~= nil then
|
||||
SetEntityHealth(vehicle, props.health)
|
||||
if props.bodyHealth ~= nil then
|
||||
SetVehicleBodyHealth(vehicle, props.bodyHealth)
|
||||
end
|
||||
|
||||
if props.engineHealth ~= nil then
|
||||
SetVehicleEngineHealth(vehicle, props.engineHealth)
|
||||
end
|
||||
|
||||
if props.dirtLevel ~= nil then
|
||||
|
||||
Reference in New Issue
Block a user