If a players health is less than something draw a box?
4 replies, posted
Worst title ever but, let me explain.
In this in hud I'm making, i want it so if a players health is < 50 it draws a box with text in it on their screen. and how do i get their health? And if their health is > 50 i want it the box to not exist
[code] draw.RoundedBox(0,280,ScrH() - 25,150,20,Color(0,0,0,200))
draw.RoundedBox(0,282,ScrH() - 23,math.Clamp(hp,0,100)*1.46,16,Color(127,0,0,200))
draw.SimpleText("Health: "..hp,"TargetID",320,ScrH() - 23)
if hp <50 then
draw.RoundedBox(0, 270,ScrH() ScrH() - 25,150,20,Color(0,0,0,200))
etc?
[/code]
etc.
I'm really bad at lua, so sorry if im looking like an idiot with that code.
Uh, [code]local hp = LocalPlayer():Health()[/code]
[editline]5th April 2016[/editline]
???
[QUOTE=Robotboy655;50073561]Uh, [code]local hp = LocalPlayer():Health()[/code]
[editline]5th April 2016[/editline]
???[/QUOTE]
Yea, sorry that is defined at the top of the document. Is just i dont know how to make it draw a box if the health is less than 50
You cannot "define" that at the top of the document, it must be inside your HUDPaint hook so that it updates its value every frame.
Oh, okay.
Sorry, you need to Log In to post a reply to this thread.