Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (SERVER) then return nil end
- hud = {}
- hud.maxammo = {}
- VERSION = .91
- function hud.HUD() // loops
- if hudremoved then return end
- local Client = LocalPlayer() // Name Clients
- local Player = LocalPlayer() // Just in case
- local Weapon = tostring( Client:GetActiveWeapon():GetPrintName() ) // Tostring stops the bugs
- if !Client:Alive() then return end // No HUD when dead
- if Weapon == "#GMOD_Camera" then return end
- if !hud.maxammo[weapon] then // If Doesn't Exist
- hud.maxammo[weapon] = {} // Make new
- hud.maxammo[weapon].p = Client:GetActiveWeapon():Clip1() // Add Primary
- hud.maxammo[weapon].s = Client:GetActiveWeapon():Clip2() // Add Secondary
- end
- if Client:GetActiveWeapon():Clip1() > hud.maxammo[weapon].p then
- hud.maxammo[weapon].p = Client:GetActiveWeapon():Clip1()
- end
- if Client:GetActiveWeapon():Clip1() > hud.maxammo[weapon].s then
- hud.maxammo[weapon].s = Client:GetActiveWeapon():Clip1()
- end
- local Health = Client:Health()
- local Armor = Client:Armor()
- local AmmoLeft = Client:GetActiveWeapon():Clip1()
- local AmmoLeft2 = Client:GetActiveWeapon():Clip2()
- local HealthPercent = percenthp( Client:Health(), Client:GetMaxHealth() )
- local AmmoPercentPrimary = percent( AmmoLeft, hud.maxammo[weapon].p )
- draw.RoundedBox(0, 40 - 1, (ScrH() - 70) - 1, 200 + 2, (16) + 2, Color(255, 255, 255, 255))
- draw.RoundedBox(0, 40, ScrH() - 70, 200, 16, Color(125, 125, 125, 150))
- local zHealth = HealthPercent * 2
- surface.SetDrawColor(255, 255, 255, 255)
- surface.SetTexture(surface.GetTextureID("CGUI/HealthBig"))
- surface.DrawTexturedRect(40, ScrH() - 70, zHealth, 16)
- draw.RoundedBox(0, 40 - 1, (ScrH() - 54) - 1, 200 + 2, (16) + 2, Color(255, 255, 255, 255))
- draw.RoundedBox(0, 40, ScrH() - 54, 200, 16, Color(125, 125, 125, 150))
- local zAmmo = AmmoPercentPrimary * 2
- surface.SetDrawColor(255, 255, 255, 255)
- surface.SetTexture(surface.GetTextureID("CGUI/AmmoBig"))
- surface.DrawTexturedRect(40, ScrH() - 54, zAmmo, 16)
- draw.RoundedBox(0, 40 - 1, (ScrH() - 38) - 1, 200 + 2, (16) + 2, Color(255, 255, 255, 255))
- draw.RoundedBox(0, 40, ScrH() - 38, 200, 16, Color(125, 125, 125, 150))
- local zArmor = Armor * 2
- surface.SetDrawColor(255, 255, 255, 255)
- surface.SetTexture(surface.GetTextureID("CGUI/ArmorBig"))
- surface.DrawTexturedRect(40, ScrH() - 38, 200, 16)
- draw.SimpleText(""..HealthPercent.." Health ", "ScoreboardText",42, ScrH()-72, Color(0, 0, 0, 255), 0, 0)
- draw.SimpleText("Armor Unknown", "ScoreboardText",42, ScrH()-39, Color(0, 0, 0, 255), 0, 0)
- if AmmoLeft == -1 then
- draw.SimpleText("Infinite Ammo", "ScoreboardText",42, ScrH()-56, Color(0, 0, 0, 255), 0, 0)
- else
- draw.SimpleText(""..AmmoLeft.."/"..hud.maxammo[weapon].p.." Ammo", "ScoreboardText",40, ScrH()-56, Color(0, 0, 0, 255), 0, 0)
- end
- end
- hook.Add( "HUDPaint", "CustomHud", hud.HUD )
- function percenthp( num, max )
- return (num / max) * 100 / 10 / 10
- end
- function percent( num, max )
- return (num / max) * 100
- end
- function hud.HideHUD( name )
- if !hudremoved then
- if name == "CHudHealth" then return false end
- if name == "CHudBattery" then return false end
- if name == "CHudAmmo" then return false end
- if name == "CHudSecondaryAmmo" then return false end
- end
- return true
- end
- hook.Add("HUDShouldDraw","hud.HideHUD",hud.HideHUD)
- hudremoved = false
- function hud.remove()
- if hudremoved == false then
- hudremoved = true
- elseif hudremoved == true then
- hudremoved = false
- end
- end
- concommand.Add("chud_toggle","remove",hud.remove) --So many choices
- // CHANGE FILE SIZE FOR OVERWRITE WARNING
- // CHANGE FILE SIZE FOR OVERWRITE WARNING
- // CHANGE FILE SIZE FOR OVERWRITE WARNING
- // CHANGE FILE SIZE FOR OVERWRITE WARNING
- // CHANGE FILE SIZE FOR OVERWRITE WARNING
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement