• Need help with hud effects
    5 replies, posted
I'm trying to make the health bar flash when damage is taken heres my code function HUD() // hud top left if LocalPlayer():GetNetworkedBool("InChopper") && !(LocalPlayer():GetNetworkedBool("UsingCam")) then surface.SetDrawColor( 255, 0, 0, 255 ) surface.DrawOutlinedRect( LocalPlayer().AIMPOS.x-5, LocalPlayer().AIMPOS.y-5, 10, 10 ) for k,v in pairs(ents.GetAll()) do if (v:IsNPC() || v:IsPlayer()) && v!=LocalPlayer() then local pos = v:GetPos() + Vector(0,0,30) local name = "Undefined Target" if v:IsNPC() then name = v:GetClass() end if v:IsPlayer() then name = v:Nick() end draw.DrawText( "+", "ScoreboardText", pos:ToScreen().x, pos:ToScreen().y-10, Color(255, 255, 255, 255), 1 ) draw.DrawText( name, "ScoreboardText", pos:ToScreen().x+3, pos:ToScreen().y-15, Color(255, 255, 255, 255), 0 ) end end local GRTime = math.Max(CurTime()-LocalPlayer():GetNetworkedInt("HGunReloadTime")-0.1,0) GRTime = math.Min(2, GRTime) draw.RoundedBox( 4, 25, 20, 10, (ScrH()-550), Color(0,0,0,150) ) if GRTime!=0 then draw.RoundedBox( 4, 100, 20, 10, (GRTime/2)*(ScrH()-40), Color(0,0,0,150) ) end for loop=1, 20, 1 do // draw.RoundedBox( 4, 20, (loop*(ScrH()/22)), 20, 15, Color(0,0,0,150) ) // this is the looped boxes that holds clip values not using atm end //for loop=1,LocalPlayer():GetNetworkedInt("HBullets"), 1 do // these are the actual bullets that fill the loop remeber im not using them atm // draw.RoundedBox( 4, 23, ((21-loop)*(ScrH()/22))+3, 14, 9, Color(0,0,0,150) ) //end BRTime = math.Min(CurTime()-LocalPlayer():GetNetworkedInt("HLastBomb"),3) draw.RoundedBox( 4, ScrW()-300, 20, 250, 70, Color(0,0,0,150) ) if BRTime!=0 then draw.RoundedBox( 4, ScrW()-300, 20, BRTime*(250/1.5), 70, Color(0,0,0,150) ) end draw.SimpleText( "This is a Beta version of CPHelicopter - By Grimmfang","ScoreboardText", 0, 0, Color(255, 255, 255, 255), 0, 0) draw.RoundedBox(4, -20, -20, 140, 300, Color(51, 58, 51, 175)) Healthz = LocalPlayer():GetNetworkedInt("HHealthz")/1200 // health hud draw.RoundedBox( 4, ScrW()-1200, 55, 17, (ScrH()-550), Color(0,0,0,150) ) // health bar background if BRTime!=0 then draw.RoundedBox( 4, ScrW()-100, ScrH() - ((ScrH()-120)*Healthz+20),50, (ScrH()-120)*Healthz, Color(0,0,0,150) ) end // health bar filler end end hook.Add("HUDPaint", "ChopperHUD", HUD) code [editline]06:37AM[/editline] bump [editline]06:37AM[/editline] bump
This belongs in garrysmod discussion. I think.
I like how you tried to bump your own thread, Only to be foiled by automerge.
i know rite
lmao you are terrible at this
you know it
Sorry, you need to Log In to post a reply to this thread.