Garry's Mod
HUD SW RP
Submitted by masanthey, 12-07-2020, 02:54 AM, Thread ID: 176168
Thread Closed
12-07-2020, 02:54 AM
#1 This simple HUD is easy to install and easy to operate, simple and reliable.
Code:
simplistic_toggle = 1;
concommand.Add("simplistichud_toggleoff",function( ply, cmd, args )
simplistic_toggle = 0;
print("Simplistic HUD v2 - Toggled Off")
print("Type 'simplistichud_toggleon' to reactivate Simplistic HUD v2")
end)
concommand.Add("simplistichud_toggleon",function( ply, cmd, args )
simplistic_toggle = 1;
print("Simplistic HUD v2 - Toggled On")
print("Type 'simplistichud_toggleoff' to deactivate Simplistic HUD v2")
end)
function health()
local client = LocalPlayer()
local health = client:Health()
if simplistic_toggle == 1 then
draw.RoundedBox(0, 30, ScrH() -48, 250, 3, Color(255, 255, 255, 255))
draw.RoundedBox(0, 30, ScrH() -40, 200, 15, Color(255, 255, 255, 80))
draw.RoundedBox(0, 30, ScrH() -40, math.Clamp(health * 2, 0, 200), 15, Color(255, 255, 255, 255))
if health <= 0 then
draw.SimpleText("" , "Trebuchet24", 234, ScrH() -32, Color (255, 255, 255), TEXT_ALIGN_LEFT, 1)
else
draw.SimpleText(health.." " , "Trebuchet24", 237, ScrH() -32, Color (255, 255, 255), TEXT_ALIGN_LEFT, 1)
end
else
end
end
function armor()
local client = LocalPlayer()
local armor = client:Armor()
if simplistic_toggle == 1 then
if armor <= 0 then return end
draw.SimpleText(armor.. " " , "Trebuchet24", 237, ScrH() -60, Color (255, 255, 255), TEXT_ALIGN_LEFT, 1)
draw.RoundedBox(0, 30, ScrH() -68, 200, 15, Color( 255, 255, 255, 80))
draw.RoundedBox(0, 30, ScrH() -68, math.Clamp(armor * 2, 0, 200), 15, Color(255, 255, 255))
else
end
end
function wepname()
local client = LocalPlayer()
local health = client:Health()
if simplistic_toggle == 1 then
draw.RoundedBox(0, ScrW() -280, ScrH() -48, 250, 3, Color(255, 255, 255, 255), ALIGN_RIGHT)
if health < 1 then
else
local client = LocalPlayer()
local weapon = LocalPlayer():GetActiveWeapon()
if IsValid(weapon) then
local ammo = client:GetAmmoCount( weapon:GetPrimaryAmmoType() )
local name = weapon:GetPrintName()
if name == nil then return end
if ammo <= 0 then
draw.SimpleText(client:GetActiveWeapon():GetPrintName(), "Trebuchet24", ScrW() - 30, ScrH() -45, Color(255, 255, 255), TEXT_ALIGN_RIGHT, 0)
elseif ammo >= 1 then
draw.SimpleText(client:GetActiveWeapon():GetPrintName(), "Trebuchet24", ScrW() - 30, ScrH() -45, Color(255, 255, 255), TEXT_ALIGN_RIGHT, 0)
end
end
end
else
end
end
function ammo()
local client = LocalPlayer()
local weapon = client:GetActiveWeapon()
if simplistic_toggle == 1 then
if IsValid(weapon) then
local clip = weapon:Clip1()
local ammo = client:GetAmmoCount( weapon:GetPrimaryAmmoType() )
if ammo == -1 or ammo == 0 and clip <= -1 then return end
if clip != -1 then
draw.SimpleText(""..clip.."/"..ammo, "Trebuchet24", ScrW() -30, ScrH() - 71, Color(255, 255, 255),TEXT_ALIGN_RIGHT ,0)
else
draw.SimpleText(""..ammo, "Trebuchet24", ScrW() -30, ScrH() - 71, Color(255, 255, 255),TEXT_ALIGN_RIGHT ,0)
end
end
end
end
function ammo2()
local client = LocalPlayer()
local weapon = LocalPlayer():GetActiveWeapon()
if simplistic_toggle == 1 then
if IsValid(weapon) then
local clip = weapon:Clip2()
local ammo = LocalPlayer():GetAmmoCount( weapon:GetSecondaryAmmoType() )
local ammomain = client:GetAmmoCount( weapon:GetPrimaryAmmoType() )
if ammo == -1 or ammo <= 0 then return end
if clip > 0 then
draw.SimpleText(""..client:GetAmmoCount(client:GetActiveWeapon():GetSecondaryAmmoType()).."/"..client:GetAmmoCount(client:GetActiveWeapon():GetSecondaryAmmoType()), "Trebuchet24", ScrW() -30, ScrH() - 71, Color(255, 255, 255),TEXT_ALIGN_RIGHT ,0)
else
draw.SimpleText(""..client:GetAmmoCount(client:GetActiveWeapon():GetSecondaryAmmoType()).."/"..client:GetAmmoCount(client:GetActiveWeapon():GetSecondaryAmmoType()), "Trebuchet24", ScrW() -30, ScrH() - 90, Color(255, 255, 255),TEXT_ALIGN_RIGHT ,0)
end
end
else
end
end
function user()
local client = LocalPlayer()
local name = client:GetName()
local kills = client:Frags()
local deaths = client:Deaths()
local ping = client:Ping()
if simplistic_toggle == 1 then
draw.SimpleText(""..name, "Trebuchet24", 29, 25, Color(255, 255, 255), TEXT_ALIGN_LEFT, 0)
draw.SimpleText("Kills: "..kills..", Deaths: "..deaths..",", "Trebuchet18", 30, 51, Color(255, 255, 255), TEXT_ALIGN_LEFT, 0)
draw.RoundedBox(0, 30, 48, 250, 3, Color(255, 255, 255, 255), ALIGN_LEFT, 0)
end
end
function HUD()
health()
armor()
wepname()
ammo()
ammo2()
user()
end
hook.Add("HUDPaint", "HUD", HUD)
local tohide = {
["CHudHealth"] = true,
["CHudBattery"] = true,
["CHudAmmo"] = true,
["CHudSecondaryAmmo"] = true
}
local function HUDShouldDraw(name)
if (tohide[name]) then
return false;
end
end
hook.Add("HUDShouldDraw", "Simplistic Hud", HUDShouldDraw)
Users browsing this thread: 1 Guest(s)