Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
tweak(client): health bar logic
  • Loading branch information
renzuzu committed Aug 30, 2021
1 parent 1ddbf33 commit 6675d9d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
13 changes: 8 additions & 5 deletions renzu_hud/client/client.lua
Expand Up @@ -633,11 +633,14 @@ AddEventHandler('gameEventTriggered', function (name, args)
if not inshock then
inshock = true
shockcount = 4
while inshock and shockcount > 1 do
Hud:updateplayer(true)
shockcount = shockcount - 1
Wait(100)
end
CreateThread(function()
while inshock and shockcount > 1 do
Hud:updateplayer(true)
shockcount = shockcount - 1
Wait(500)
end
return
end)
Wait(100)
if config.bodystatus then
Hud:BodyLoop()
Expand Down
9 changes: 6 additions & 3 deletions renzu_hud/client/function.lua
Expand Up @@ -1396,13 +1396,16 @@ end
local firstload = 0
function Hud:updateplayer(instant)
if self.ped == nil then return end
health = (GetEntityHealth(self.ped)/2) * 0.99
health = (GetEntityHealth(self.ped)-100) * 0.99
armor = GetPedArmour(self.ped) * 0.99
self.pid = PlayerId()
SendNUIMessage({
hud = "setArmor",
content = armor
})
if health <= 0 then
health = 0
end
if config.statusordering['armor'] then
config.statusordering['armor'].value = armor
end
Expand Down Expand Up @@ -2707,7 +2710,7 @@ end

function Hud:BodyMain()
if health == nil then
health = GetEntityHealth(PlayerPedId()) / 2
health = GetEntityHealth(PlayerPedId()) -100
end
self.life = health
if health ~= nil and self.life < self.oldlife then
Expand All @@ -2734,7 +2737,7 @@ function Hud:BodyMain()
end
end
end
self.oldlife = GetEntityHealth(self.ped) / 2
self.oldlife = GetEntityHealth(self.ped) -100
end

function Hud:Makeloading(msg,ms)
Expand Down

0 comments on commit 6675d9d

Please sign in to comment.