So i have had a working stamina bar for sprinting on garry's mod for quite some time. I have always noticed that the stamina bar is actually below the hud, making the bar a bit dark. (This is being used on TTT)
I was wondering if i could get some quick help as far as placing the bar above the hud goes.
cl code
[CODE]hook.Add("HUDPaint", "SprintBarHUD", function()
if TEAM_SPEC == nil then return end
if !LocalPlayer():Alive() or LocalPlayer():Team() == TEAM_SPEC then return end
local y = ScrH() - 24 -- Y axis for the bar
draw.RoundedBox(4, 21, y, 230, 12, Color(25, 100, 25, 222))
draw.RoundedBox(4, 21, y+1, 228 * math.max(LocalPlayer():GetNWFloat("stamina", 0), 0.02), 9, Color(50, 200, 50, 250))
draw.SimpleText("Sprint (Double tap W)", "Trebuchet18", 100, y-3, Color(255, 255, 255))
--draw.SimpleText("Divan's TTT", "Trebuchet18", 100, y-3, Color(255, 255, 255))
end)[/CODE]
[CODE]hook.Add("HUDPaint", "SprintBarHUD", function()
if TEAM_SPEC == nil then return end
if !LocalPlayer():Alive() or LocalPlayer():Team() == TEAM_SPEC then return end
local y = ScrH() - 24 -- Y axis for the bar
draw.SimpleText("Sprint (Double tap W)", "Trebuchet18", 100, y-3, Color(255, 255, 255))
draw.RoundedBox(4, 21, y, 230, 12, Color(25, 100, 25, 222))
draw.RoundedBox(4, 21, y+1, 228 * math.max(LocalPlayer():GetNWFloat("stamina", 0), 0.02), 9, Color(50, 200, 50, 250))
--draw.SimpleText("Divan's TTT", "Trebuchet18", 100, y-3, Color(255, 255, 255))
end)[/CODE]
HUD is rendered in "chronological" order, meaning you just have to swap the box lines around.
[QUOTE=BillyOnWiiU;49493119][CODE]hook.Add("HUDPaint", "SprintBarHUD", function()
if TEAM_SPEC == nil then return end
if !LocalPlayer():Alive() or LocalPlayer():Team() == TEAM_SPEC then return end
local y = ScrH() - 24 -- Y axis for the bar
draw.SimpleText("Sprint (Double tap W)", "Trebuchet18", 100, y-3, Color(255, 255, 255))
draw.RoundedBox(4, 21, y, 230, 12, Color(25, 100, 25, 222))
draw.RoundedBox(4, 21, y+1, 228 * math.max(LocalPlayer():GetNWFloat("stamina", 0), 0.02), 9, Color(50, 200, 50, 250))
--draw.SimpleText("Divan's TTT", "Trebuchet18", 100, y-3, Color(255, 255, 255))
end)[/CODE]
HUD is rendered in "chronological" order, meaning you just have to swap the box lines around.[/QUOTE]
That seem to have made the text above the bar impossible to read. Maybe these box lines and text line should be in another order? I can go ahead and play around with it.
Is the HUD you're talking about the TTT default hud?
[QUOTE=FVJohnny;49493821]Is the HUD you're talking about the TTT default hud?[/QUOTE]
Yes
HUD rendered with the draw or surface library are always underneath Derma. Why not move the HUD around so it's not under the default HUD?
Sorry, you need to Log In to post a reply to this thread.