Skip to content

Commit

Permalink
Fix issue when vehicle health returns NaN
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonardoSoares98 committed Oct 17, 2024
1 parent 4ec5deb commit d51730f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,10 @@ CreateThread(function()
DisplayRadar(true)
end
wasInVehicle = true
local engineHealth = GetVehicleEngineHealth(vehicle)
if engineHealth ~= engineHealth then -- This checks for NaN, as any NaN value is not equal to itself
engineHealth = 0
end
updatePlayerHud({
show,
Menu.isDynamicHealthChecked,
Expand Down Expand Up @@ -793,7 +797,7 @@ CreateThread(function()
harness,
hp,
math.ceil(GetEntitySpeed(vehicle) * speedMultiplier),
(GetVehicleEngineHealth(vehicle) / 10),
(engineHealth / 10),
Menu.isCinematicModeChecked,
dev,
radioActive,
Expand Down

0 comments on commit d51730f

Please sign in to comment.