Code:
local ELEMENT = mhud.New("mHud Fps")
local self = LocalPlayer
surface.CreateFont( "namefont", {
font = "Helvetica",
size = 24,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true
} )
surface.CreateFont( "namefontsmall", {
font = "Helvetica",
size = 24,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true
} )
surface.CreateFont( "healthfont", {
font = "Helvetica",
size = 16,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true
} )
surface.CreateFont( "healthfont2", {
font = "Helvetica",
size = 20,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true
} )
local Health = 0
local av
local name
local oldName
local function DrawPlayerAvatar( p )
av = vgui.Create("AvatarImage")
av:SetPos(20,ScrH() - 130)
av:SetSize(64, 64)
av:SetPlayer( p, 64 )
end
local function bizzahud()
draw.RoundedBox( 4, 10, ScrH() - 143, 392, 133, Color( 0, 0,0, 255 ) )
local font
surface.SetFont( "namefont" )
local PlayerName = LocalPlayer():Name()
local Width, Height = surface.GetTextSize(PlayerName)
if Width > 100 then
font = "namefontsmall"
else
font = "namefont"
end
surface.SetFont( "namefontsmall" )
local wh, hw = surface.GetTextSize(PlayerName)
if font == "namefontsmall" and wh > 100 then
PlayerName = string.sub( LocalPlayer():Name(), 1, 18 )
end
if font == "namefont" and Width < 100 then
local PlayerName = LocalPlayer():Name()
end
draw.SimpleText( PlayerName, font, 150, ScrH() - 110, Color( 255, 255, 255 ) )
local x, y = 30, ScrH() - 20
local localplayer = LocalPlayer()
Health = math.min(100, (Health == localplayer:Health() and Health) or Lerp(0.1, Health, localplayer:Health()))
local DrawHealth = math.Min(Health , 1)
local Border = math.Min(6, math.pow(2, math.Round(3*DrawHealth)))
draw.RoundedBox(4, 20 + 60, y - 33, 309 - 7, 16, Color(0,0,0,200))
if LocalPlayer():Health() > 0 then
draw.RoundedBox(4, 21 + 60, y - 32, (309 - 9) * DrawHealth, 14, Color(255,40,40,180))
end
pos
draw.DrawText(math.Max(0, math.Round(localplayer:Health())), "healthfont", 302 / 2 + 80, y - 33, Color(255,255,255,200), 1, TEXT_ALIGN_CENTER)
local armor = LocalPlayer():Armor()
draw.RoundedBox(4, 20 + 60, ScrH() - 34, 302, 16, Color(0,0,0,200))
if armor > 0 then
draw.RoundedBox(4, 21 + 60, ScrH() - 33, armor * 3, 14, Color(40,40,255,255))
end
draw.SimpleText(armor, "healthfont", 80 + 302 / 2, ScrH() - 33, Color(255,255,255,200), TEXT_ALIGN_CENTER)
draw.SimpleText("Health:", "healthfont2", 20, ScrH() - 54, Color(255,255,255,255), TEXT_ALIGN_LEFT)
draw.SimpleText("Armor:", "healthfont2", 20, ScrH() - 36, Color(255,255,255,255), TEXT_ALIGN_LEFT)
if av then
return
else
DrawPlayerAvatar( LocalPlayer() )
end
end
hook.Add("HUDPaint", "HUDByMrIbizza", bizzahud)
function disableCHUD(name)
if name == "CHudHealth" or name == "CHudBattery" or name == "CHudAmmo" or name == "CHudSecondaryAmmo" then
return false
end
end
hook.Add("HUDShouldDraw", "disablethisshit", disableCHUD)
local function ELEMENT.Paint()
local x, y = ScrW() / 2, ScrH() - 40
mhud.DrawProgress(5, x, y, 180, 4, math.floor(1 / RealFrameTime()), 300, true)
end
ELEMENT:AddHook("HUDPaint", ELEMENT.Paint, "mhud_fps_paint")
mhud.Register(ELEMENT)