Mafia's HUD Template - Fixed!

Hello once again, I have finished a better HUD template that the code is less trashy.
It includes,
Health and Armor Bar
Steam Image
In-Game Name

Simply remove these defaults by removing their function name under startFunctions() if you wish so.
I hope you enjoy and maybe some new people learn some new things.



-- Mafia's HUD Template
-- Version 12-9-16

local tHealth = 100
local tArmor = 100
local weapon = LocalPlayer():GetActiveWeapon()
local plyIMGon = false

local hideHL2HUD =  {
	["CHudHealth"] = true,
	["CHudBattery"] = true,
}
hook.Add("HUDShouldDraw", "HideDefDarkHUD", function( name )
	if hideHL2HUD[ name ] then return false end
end )

surface.CreateFont( "tFont", {
	font = "Consolas",
	extended = false,
	size = 20,
	weight = 500,
	blursize = 0,
	scanlines = 0,
	antialias = true,
	underline = false,
	italic = true,
	strikeout = false,
	symbol = false,
	rotary = false,
	shadow = false,
	additive = false,
	outline = false,
} )

local function Base()
	draw.RoundedBox(0, 5, ScrH() - 125, 420, 120, Color(0, 0, 0, 210))
	draw.RoundedBox(0, 5, ScrH() - 250 + 11, 84 + 25 , 84 + 25, Color(0, 0, 0, 210))
	draw.RoundedBox(0, 120, ScrH() - 155, 305, 25, Color(0, 0, 0, 210))
end

local function plyIMG() -- Decided to replace with Steam Avatar
	if plyIMGon == false then
		plyIMGon = true
		local a = vgui.Create( "AvatarImage" )
		a:SetSize( 84,84 )
		a:SetPos( 16, ScrH() - 250 + 25 )
		a:SetPlayer( LocalPlayer(), 64 )
	end
end

local function plyStats() -- Add extra stats here
	local namestat = LocalPlayer():Name()
	draw.DrawText( namestat, "Trebuchet18", 125, ScrH() - 150, Color( 255,255,255,255 ), TEXT_ALIGN_LEFT)
end

local function plyHealth()
	local Het = LocalPlayer():Health()
	tHealth = Lerp(0.02 , 100 , LocalPlayer():Health())
	draw.RoundedBox(0, 15, ScrH() - 125 + 7, 450 - 50, 50, Color(0, 0, 0, 230))
	draw.RoundedBox(0, 15, ScrH() - 125 + 7, tHealth * 5 - 50 - 50, 50, Color( 255, 120, 120, 255 ))
	draw.RoundedBox(0, 15, ScrH() - 125 + 7, tHealth * 5 - 50 - 50, 5, Color(255, 150, 150, 255))
	draw.DrawText("Health : "..Het, "tFont", 20, ScrH() - 102,Color(255, 255, 255, 255), TEXT_ALIGN_LEFT)
end

local function plyArmor()
	local Arm = LocalPlayer():Armor()
	tArmor = Lerp(0.02 , tArmor , LocalPlayer():Armor())
	draw.RoundedBox(0, 15, ScrH() - 62, 450 - 50, 50, Color(0, 0, 0, 230))
	draw.RoundedBox(0, 15, ScrH() - 62, tArmor * 5 - 50 - 50, 50, Color( 66, 134, 244, 255 ))
	draw.RoundedBox(0, 15, ScrH() - 62, tArmor * 5 - 50 - 50, 5, Color(66, 164, 255, 255))
	draw.DrawText("Armor : "..Arm, "tFont", 20, ScrH() - 47,Color(255, 255, 255, 255), TEXT_ALIGN_LEFT)
end

function startFunctions()
	Base()
	plyIMG()
	plyHealth()
	plyArmor()
	plyStats()
end
hook.Add( "HUDPaint", "drawourHUD", startFunctions )


EDIT:

Yet another hud to clutter up scriptfodder…
It okay for a MafiaRP gamemode though :stuck_out_tongue:

Yeah to be true, I would hope no one uses this to add on ScriptFodder, because even I believe it could use MAJOR design work, instead of having the background just transparent black.

To be honest the only good huds out there for rp reasons are probably the gta 5 one which is pretty cool and actually changes stuff in game.
Unless your HUD does something innovative or cool…
It’ll probably get ignored and left alone for a long while
I tested it out though,It’s good for old school rp servers who want something different for the eyes :stuck_out_tongue:

Yeah, right now I am trying to make a new fresh HUD that is unique and will stay that way as long as possible.

I would suggest to change the font and decrease the size