- Initiateur de la discussion
Firyo89
Geek suprême
- Messages
- 572
- Score réaction
- 123
- Points
- 170
Salut, je suis entrain de crée mon HUD mais quand je me met à plus de 100 HP/100 Armor la barre dépace.
Code:
if SERVER then resource.AddFile( "resource/fonts/Lato-Light.ttf" ) return
end
surface.CreateFont( "police1", { font = "Lato Light", size = 16, weight = 500, antialias = true, strikeout = true, additive = true,
} )
surface.CreateFont( "police2", { font = "Lato Light", size = 20, weight = 500, antialias = true, strikeout = true, additive = true,
} )
hook.Add("HUDPaint", "firyo", function() if !LocalPlayer():Alive() then return end local health = LocalPlayer():Health() local armor = LocalPlayer() :Armor() local food = LocalPlayer() :getDarkRPVar("Energy") draw.RoundedBox(0, 7, ScrH() - 72, 306, 19, Color(0,0,0,180)) draw.RoundedBox(0, 10, ScrH() - 70, health * 3, 14, Color(255,20,20,255)) draw.SimpleText(health, "police1", 15, ScrH() - 51, Color(255,255,255)) draw.RoundedBox(0, 7, ScrH() - 57, 306, 19, Color(0,0,0,180)) draw.RoundedBox(0, 10, ScrH() - 55, armor * 3, 14, Color(0,51,204,255)) draw.SimpleText(armor, "police1", 15, ScrH() - 26, Color(255,255,255)) draw.RoundedBox()
end)
--Cacher le HUD de base
local hideHUDElements = { ["DarkRP_LocalPlayerHUD"] = true, ["DarkRP_Agenda"] = true, ["DarkRP_Hungermod"] = true,
}
hook.Add("HUDShouldDraw", "HideDefaultDarkRPHud", function(name) if hideHUDElements[name] then return false end
end)
local hide = {}
hide[ "CHudHealth" ] = true
hide[ "CHudBattery" ] = true
hook.Add( "HUDShouldDraw", "HideHUD", function( name ) if hide[ name ] then return false end
end )