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
[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 < 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