Specifically made this fix for Kato, saw his thread and its typical to see no responses after a few days… This community lol.
Reply if you need help
With your specific hud, whether it’s trew hud, np hud, qbus hud, flat hud, esx_hud, kl_hud, ln-hud, unknownlife_hud, nzy-hud, etc; disclaimer, most of the huds you download in public are already going to have this fix implemented, which is typically invisible to the naked eye for new server developers/creators! Health in the HUD BEFORE the changehttps://prnt.sc/ugod2g Code BEFORE the changehttps://prnt.sc/ugoe4l
Citizen.CreateThread(function()
while true do
Citizen.Wait(1)
if GetEntityMaxHealth(GetPlayerPed(-1)) ~= 200 then
SetEntityMaxHealth(GetPlayerPed(-1), 200)
SetEntityHealth(GetPlayerPed(-1), 200)
end
If you need help putting this where it needs to be, just reply here, If I can’t get to you then I’m sure someone else who used this fix can help you
This is the proper way, other post’s I’ve read, didn’t really explain it much when I first got started, but since then I haven’t had any issues with this way of doing it, just make sure its at the top of where your huds Citizen.CreateThread(function() is declared after the while true do statement, the screenshots will explain it if you’re new, just reference those and see how your code is, compare it and see how you can implement this simple block into your own hud’s code. <3
hello,I need some help:(
I don’t know where do i put the Code:(
Citizen.CreateThread(function()
while loaded == false do
Citizen.Wait(300)
end
while true do
Citizen.Wait(300)
local ped = GetPlayerPed(-1)
local playerId = PlayerId()
SetPlayerHealthRechargeMultiplier(playerId, 0)
local pedhealth = GetEntityHealth(ped)
if pedhealth < 100 then
health = 0
else
pedhealth = pedhealth - 100
health = pedhealth
end
armor = GetPedArmour(ped)
oxygen = GetPlayerUnderwaterTimeRemaining(playerId)*10
oxygen = math.ceil(oxygen)
SendNUIMessage({
type = "update",
id = id,
health = health,
armor = armor,
food = food,
water = water,
oxygen = oxygen,
job = job,
jobgrade = jobgrade,
socBal = socBal,
})
end
end)