You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I was coding my HUD addon, I realized that Entity:GetMaxHealth does not updates immediately after Entity:SetMaxHealth.
You have to jump to update the value.
Steps to reproduce
Create a lua file in autorun directory, and paste these:
if SERVER then
AddCSLuaFile()
Entity( 1 ):SetMaxHealth(1000)
end
if LocalPlayer then
local function Test()
local myplayer = LocalPlayer()
print(myplayer:GetMaxHealth())
end
hook.Add( 'HUDPaint', 'Test', Test )
end
Save.
Then type in console: developer 1
Modify the player's Maximum health (the number 1000) to anything you want, and save the file to apply them in game.
Now watch the developer 1 logs. The number will not change until you jump (jump is working for all weapons, if you have Crowbar, then you can do it by left clicking too.)
The text was updated successfully, but these errors were encountered:
aL1NaZ4R
changed the title
Entity:GetMaxHealth updates too late.
Entity:GetMaxHealth does not updates
Dec 19, 2022
aL1NaZ4R
changed the title
Entity:GetMaxHealth does not updates
Entity:GetMaxHealth does not updates automatically
Dec 19, 2022
Details
When I was coding my HUD addon, I realized that Entity:GetMaxHealth does not updates immediately after Entity:SetMaxHealth.
You have to jump to update the value.
Steps to reproduce
Create a lua file in autorun directory, and paste these:
Save.
Then type in console:
developer 1
Modify the player's Maximum health (the number 1000) to anything you want, and save the file to apply them in game.
Now watch the
developer 1
logs. The number will not change until you jump (jump is working for all weapons, if you have Crowbar, then you can do it by left clicking too.)The text was updated successfully, but these errors were encountered: