Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local hudEnabled = false --Default setting for whether the HUD is on or not
- local function hideViralHUD() --When this function is called, stop drawing the custom HUD
- hook.Remove("HUDPaint", "DrawMyHud")
- hook.Add("HUDShouldDraw","HUDShouldDraw",function( name )
- return true
- end)
- end
- local function toggleHUD() --Toggle the HUD on and off with this function
- if hudEnabled == false then
- print("Viral's HUD has been enabled")
- hudEnabled = true
- elseif hudEnabled == true then
- print("Viral's HUD has been disabled")
- hudEnabled = false
- end
- end
- concommand.Add("viral_hud_toggle", toggleHUD) --Add a console command which calls the toggleHUD function written above
- // you cheeky cunt you why are you in here YOU VIOLATING ME
- surface.CreateFont( "HUDFont", {
- font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
- extended = false,
- size = 50,
- weight = 500,
- blursize = 0,
- scanlines = 0,
- antialias = true,
- underline = false,
- italic = false,
- strikeout = false,
- symbol = false,
- rotary = false,
- shadow = false,
- additive = true,
- outline = false,
- } )
- surface.CreateFont( "SmallHUDFont", {
- font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
- extended = false,
- size = 30,
- weight = 500,
- blursize = 0,
- scanlines = 0,
- antialias = true,
- underline = false,
- italic = false,
- strikeout = false,
- symbol = false,
- rotary = false,
- shadow = false,
- additive = true,
- outline = false,
- } )
- local hide = {
- CHudHealth = true,
- CHudBattery = true,
- CHudCrosshair = false,
- }
- hook.Add( "HUDShouldDraw", "HideHUD", function( name )
- if hudEnabled == true then
- if ( hide[ name ] ) then
- return false
- end
- -- Don't return anything here, it may break other addons that rely on this hook.
- end
- end)
- hook.Add("HUDPaint","DrawMyHud",function()
- if hudEnabled == true then
- PLY_SPEED = LocalPlayer():GetVelocity():Length()
- if LocalPlayer():InVehicle() then
- if LocalPlayer():GetVehicle():GetParent():IsValid() then
- speed = (LocalPlayer():InVehicle() and (LocalPlayer():GetVehicle():GetParent():GetVelocity():Length())) or (LocalPlayer():GetVelocity():Length())
- else
- speed = (LocalPlayer():InVehicle() and (LocalPlayer():GetVehicle():GetVelocity():Length())) or (LocalPlayer():GetVelocity():Length())
- end
- else speed = PLY_SPEED end
- MPH = speed/17.6
- KPH = MPH*1.609344
- local health = LocalPlayer():Health()
- local armor = LocalPlayer():Armor()
- local name = LocalPlayer():GetName()
- --[
- draw.RoundedBox(0,ScrW()*0.002,ScrH()*0.95,200,50,Color(0,0,0,180))//HP
- draw.RoundedBox(0,ScrW()*0.002,ScrH()*0.90,200,50,Color(0,0,0,180))//ARMOR
- draw.RoundedBox(0,ScrW()*0.11,ScrH()*0.95,300,50,Color(0,0,0,180))//SPEEDBOX
- draw.RoundedBox(0,ScrW()*0.4985,ScrH()*0.499,5,5,Color(0,0,0,255))//CROSSHAIR
- draw.RoundedBox(0,ScrW()*0.112,ScrH()*0.9823,math.Clamp(MPH+5,0,250),12,Color(0,63,255,255))//SPEEDO
- draw.SimpleText(math.floor(math.Clamp(MPH,0,2048)),"SmallHUDFont",ScrW()*0.112,ScrH()*0.9523,Color(180,180,180,255),0,0)
- draw.SimpleText("MPH |","SmallHUDFont",ScrW()*0.135,ScrH()*0.9523,Color(180,180,180,255),0,0)
- draw.SimpleText(math.floor(math.Clamp(KPH,0,2048)),"SmallHUDFont",ScrW()*0.180,ScrH()*0.9523,Color(180,180,180,255),0,0)
- draw.SimpleText("KPH","SmallHUDFont",ScrW()*0.203,ScrH()*0.9523,Color(180,180,180,255),0,0)
- draw.SimpleText(math.Clamp(health,0,9999),"HUDFont",ScrW()*0.04,ScrH()*0.950,Color(180,180,180,255),0,0)
- draw.SimpleText("HP:","SmallHUDFont",ScrW()*0.005,ScrH()*0.950,Color(255,0,0,255),0,0)
- draw.SimpleText(math.Clamp(armor,0,9999),"HUDFont",ScrW()*0.045,ScrH()*0.900,Color(180,180,180,255),0,0)
- draw.SimpleText("AMR:","SmallHUDFont",ScrW()*0.005,ScrH()*0.900,Color(0,63,255,255),0,0)
- end
- end)
- //LATER USE
- --hook.Add("HUDPaint", "hookname123", test)
- --if hudEnabled == true then
- -- function HoveringNames()
- -- for _, target in pairs(player.GetAll()) do
- -- if target:Alive() and target != LocalPlayer() then
- --
- -- local targetPos = target:GetPos() + Vector(0,0,84)
- -- local targetDistance = math.floor((LocalPlayer():GetPos():Distance( targetPos ))/40)
- -- local targetScreenpos = targetPos:ToScreen()
- -- draw.SimpleText(target:Nick(), "Trebuchet18", tonumber(targetScreenpos.x), tonumber(targetScreenpos.y), Color(0,63,255,255), TEXT_ALIGN_CENTER)
- -- end
- -- end
- -- end
- --end
- --hook.Add("HUDPaint", "HoveringNames", HoveringNames)--
- //255,0,0, RED
- //0,63,255, BLUE
- //33,255,0 GREEN
- //36,36,36 DARK GRAY
- //0,0,0, black you idiot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement