surface is drawing under another surface

Im createing a HUD, and the surfaces of the health and ammo bar are drawing under the background, so i cant see them V.V Im sure thiers a simple fix, but i cant think of it :open_mouth:

[LUA]
local HBoxBack = surface.GetTextureID( “hudofwin/hudback” );
local HBox = surface.GetTextureID( “hudofwin/healtharmour” );

function PaintHBoxBacK()
local HBoxBackSizeH = 100;
local HBoxBackSizeW = 300;
local client = LocalPlayer();

surface.SetDrawColor( 255, 255, 255, 255 );
surface.SetTexture( HBoxBack );
surface.DrawTexturedRect( 0, (ScrH() * 0.88), HBoxBackSizeW, HBoxBackSizeH );

end

function PaintHBox()
local HBoxSizeH = 48;
local phealth = LocalPlayer():Health()
local HBoxSizeW = phealth * 1.60
if(phealth < 100) then
phealth = LocalPlayer():Health()
HBoxSizeW = phealth * 1.60
else
HBoxSizeW = 160
end

surface.SetDrawColor( 255, 255, 255, 255 );
surface.SetTexture( HBox );
surface.DrawTexturedRect( 58.5, (ScrH() * 0.89), HBoxSizeW, HBoxSizeH );

end

function PaintABox()
local ABoxSizeH = 48;

local parmor = LocalPlayer():Armor()
local ABoxSizeW = parmor * 1.60 
if(parmor &lt; 100) then
    parmor = LocalPlayer():Armor()
    ABoxSizeW = parmor * 1.60
else
    ABoxSizeW = 160
end

surface.SetDrawColor( 255, 255, 255, 255 );
surface.SetTexture( HBox );
surface.DrawTexturedRect( 58.5, (ScrH() * 0.921), ABoxSizeW, ABoxSizeH );

end

// Hide the normal hud
function hidehud(name)
for k, v in pairs{“CHudHealth”, “CHudBattery”, “CHudAmmo”, “CHudSecondaryAmmo”} do
if name == v then return false end
end
end

hook.Add(“HUDShouldDraw”, “hidehud”, hidehud);
hook.Add( “HUDPaint”, “PaintHBoxBacK”, PaintHBoxBacK );
hook.Add( “HUDPaint”, “PaintHBox”, PaintHBox );
hook.Add( “HUDPaint”, “PaintABox”, PaintABox );

[/LUA]

I know its crappy code management, but its my first script xD

Hooks don’t have any specific order. Put your HUD in a single HUDPaint hook and order it as you like.

Thank you very much :smiley: