if(SERVER) then AddCSLuaFile("autorun/healthfix.lua") function UpdateHealth() local Ents = ents.GetAll() for k,v in pairs(Ents) do if(v:GetHealth() != v:Health()) then v:SetNWFloat("hp", v:Health()) end if(v:GetNWMaxHealth() != v:GetMaxHealth()) then v:SetNWFloat("maxhp", v:GetMaxHealth()) end end end timer.Create( "UpdateHealth", 1, 0, UpdateHealth ) end local meta = FindMetaTable("Entity") function meta:GetHealth() local hp = self:GetNWFloat("hp") return hp end function meta:GetNWMaxHealth() local mhp = self:GetNWFloat("maxhp") return mhp end if(CLIENT) then local function hphud() if(!LocalPlayer():Alive()) then return end local TR = LocalPlayer():GetEyeTrace() if(TR.HitWorld || !TR.Entity || !TR.Entity:IsValid()) then return end local sw,sh = ScrW(), ScrH() --draw.RoundedBox( 0, sw/2-53.5, sh/2-20, 107, 40, Color(173,255,47,200)) local String1 = "" if(TR.Entity:IsPlayer()) then String1 = TR.Entity:GetName() else String1 = TR.Entity:GetClass() end local Percent = (TR.Entity:GetHealth() / TR.Entity:GetNWMaxHealth()) * 100 local Colour = Color(math.fmod(255,(percent*100)*3),0,(percent*100)*2) draw.RoundedBox(0, (sw/2)-Percent, sh/2+20, Percent*2, 10, Colour) local Text = {} Text.text = "Name: "..String1 Text.font = "GModWorldTip" Text.xalign = TEXT_ALIGN_CENTER Text.yalign = TEXT_ALIGN_CENTER Text.pos = {sw/2, sh/2-60} Text.color = Color(0,0,0,255) draw.Text(Text) Text.text = TR.Entity:GetHealth() Text.pos[2] = sh/2-40 draw.Text(Text) end hook.Add("HUDPaint", "hphud", hphud) end