• Player take damage (HUD)
    5 replies, posted
Hello everybody, I'm searching a way to display the HUD when a player take damages but i don't find the corresponding function. Best regards,
GM/HUDPaint Entity/Health
Thank you, but how cans it detect the loss of damages ? (with Entity/Health) Because, I want to display the HUD if the player loses health.
Store the previous health to a variable, then check changes between HUDPaint hook calls.
I understand the logic but I don't know how can I do
local flPrevHealth hook.Add("HUDPaint", "DoSomethingWithHealth", function() local pPlayer = LocalPlayer() if (pPlayer:IsValid()) then local flHealth = pPlayer:Health() if (flHealth ~= flPrevHealth) then -- Health changed, do something -- Update the previous health for the next hook call flPrevHealth = flHealth end end end) Won't work with spectators
Sorry, you need to Log In to post a reply to this thread.