Hello, I'm still learning all this lua stuff and I wanted to make a vgui HUD bar thing like for your health or something else, but I'm not exactly sure how to go about with this. Is there a certain command you can use to make one or do you have to do it a more complicated way. I've never seen another thread like this and I looked for a while. Sorry if this has already been asked here, I couldn't find it. Here's a picture of what I mean:
[img]http://img193.yfrog.com/img193/4308/woodchop.jpg[/img]
It's pretty simple:
w = how wide you want your bar
m = maximum value
v = current value
x = ( v / m ) * w
[url=http://wiki.garrysmod.com/?title=Draw.RoundedBox]draw.RoundedBox[/url]( 2, 50, 50, w, 25, color_black )
[url=http://wiki.garrysmod.com/?title=Draw.RoundedBox]draw.RoundedBox[/url]( 2, 50, 50, x, 25, color_white )
are you allowed to use hex values for the color? and also could you show us a sample code for it on a HUD?
For color values, use the color structure. Color( R, G, B, A ) (0-255)
where would you put the code for it to run?
lua/autorun/client
Inside of a HudPaint hook that is. Or any other drawing hook.
Sorry, you need to Log In to post a reply to this thread.