Default GMod HUD

Heya Facepunchers! ouch, lol.

I have a question about hudding in GMod, the default boxes, where your ammo health and such is, how do you create boxes like that, and write text in them?

Its, like the fretta box where it says what team your on, how to create that?

Thanks in advantage, and sorry for my bad spelling :-).


Do you know the default color of the GMod HUDs boxes?

You should look at this addon for inspiration, it’s as close to recreating Valve’s HUD as you can get (that has been released so far).

Oh hey look at that, it’s my work. :smile: [/shamelessselfpromotion]

Just a question about this how I can make the text glowing red or yellow when we fire ?

Aand, this doesnt work because?



function drawHUD()
draw.RoundedBox( 6, 100, 50, 100, 23, Color( 255, 255, 255, 150 ) )
draw.SimpleText(“Oh No!”, “ScoreboardText”, ScrW() / 2 - 70, ScrH() - 63, Color(255,255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)

hook.Add(“HUDPaint”, “GDomHUD”, drawHUD)[/lua]


** Just an quick example, just doesnt show up.

You tell us, you’re the one with the console & screen.

  1. Did you open the script?
  2. Check the console for errors.
  3. Tell us exactly what happens (can you see 1 part, and not another?)

Judging by your current code, your text is far off the rounded box, they need to have relative cords.

  1. Yes, I did, its in init.lua
    2 No errors
    3 Nothing shows up


And its from the GMod wiki, so if the code is wrong, thats weak from their side.

init.lua is serverside, you need it in cl_init.lua

draw.SimpleText & draw.RoundedBox are 2 separate functions, you got the code from different pages.

Yes I did, but thanks for the info, imma try it out :-D.


Well, it worked perfectly, thank you :-D. Now I just need to position the box and text :silly: