Layers

I got a problem. I want to put this code over some other layers. But it keeps underneath it so nobody can see it.
Any tips?


 hook.Add("HUDPaint", "HUDHealth", function()

	local maxHealth = LocalPlayer():GetMaxHealth()
	local health = math.Clamp(LocalPlayer():Health(), 0, maxHealth)

	local healthAng = (health / maxHealth) * 180
	draw.Arc( 175, 910, 110, 6, 90, 90 + healthAng, 1, Color( 139,0,0, 200 ) )

end) 

Why not put it with the rest of your HUD code?
That way you can define which comes first in the frame easily by just moving the code to the bottom.

Made my own radar. So the code would be to long and i dont want it that other people will use it.

There are two ways you can do this.

  1. Involve the code that works with the health bar in the file
  2. Make the health bar load after the other file has loaded (the file that is causing the problem). I did that once as I figured out GMOD loads files in a folder alphabetically, but, it is not the best method.

Also take a look at this http://wiki.garrysmod.com/page/Render_Order

You’ll have to call the related layers from the same hook if you want to manually order them. I’d suggest defining each layer as a function for you to call inside a single HUDPaint hook.

Hooks run in random order, it doesn’t matter which was added first.

So put it in another file and include it.

It doesn’t matter what file it’s in, you’re sending it to the client so they can read it.