Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[-------------------------------------------------------------------------
- HUD By Valfunde from RuddyCode.fr
- I will not offer support with it, a "premium" version will come in few days / weeks with more options, more optimisation, and support. Etc.
- Thanks for downloading and using it !
- Have fun, see you
- ---------------------------------------------------------------------------]]
- --[[-------------------------------------------------------------------------
- Simple config space
- ---------------------------------------------------------------------------]]
- local server = "LeSaintServeur" -- Server name
- local tname = "Nom" -- Name word
- local thealth = "Vie" -- Health word
- local tenergy = "Faim" -- Hunger word
- local tmoney = "Argent" -- Money word
- --[[-------------------------------------------------------------------------
- HUDShouldDraw
- ---------------------------------------------------------------------------]]
- local HideElements = { "DarkRP_HUD", "DarkRP_LocalPlayerHUD", "DarkRP_EntityDisplay", "DarkRP_Agenda", "DarkRP_Hungermod" }
- local function HUDShouldDraw( Element )
- if table.HasValue( HideElements, Element ) then return false end
- end
- hook.Add( "HUDShouldDraw", "HUDShouldDraw", HUDShouldDraw )
- --[[-------------------------------------------------------------------------
- Custom fonts
- ---------------------------------------------------------------------------]]
- surface.CreateFont("valfunde_hud_32",
- {
- font = "Lato Light",
- size = 32,
- weight = 500,
- antialias = true,
- strikeout = true,
- additive = true,
- })
- surface.CreateFont("valfunde_hud_24",
- {
- font = "Lato Light",
- size = 24,
- weight = 500,
- antialias = true,
- strikeout = true,
- additive = true,
- })
- surface.CreateFont("valfunde_hud_26",
- {
- font = "Lato Light",
- size = 26,
- weight = 500,
- antialias = true,
- strikeout = true,
- additive = true,
- })
- surface.CreateFont("valfunde_hud_20",
- {
- font = "Lato Light",
- size = 20,
- weight = 500,
- antialias = true,
- strikeout = true,
- additive = true,
- })
- --[[-------------------------------------------------------------------------
- Starting HUD design
- ---------------------------------------------------------------------------]]
- hook.Add("HUDPaint", "Hud", function()
- local health = LocalPlayer():Health()
- local name = LocalPlayer():Name()
- local armor = LocalPlayer():Armor()
- local energy = LocalPlayer():getDarkRPVar("Energy") or 0
- local money = LocalPlayer():getDarkRPVar("money") or 0
- local salary = LocalPlayer():getDarkRPVar("salary") or 0
- draw.RoundedBox( 0, 12, ScrH() - 162, ScrW() / 4, 150, Color(0, 0, 0, 190))
- draw.RoundedBox( 0, 16, ScrH() - 158, ScrW() / 4 - 8, 142, Color(0, 0, 0, 150))
- draw.RoundedBox(0, 20, ScrH() - 154, ScrW() / 11, 134 , Color(0, 0, 0, 205))
- draw.RoundedBox(0, ScrW() / 9.5, ScrH() - 154, 4, 134 , Color(0, 0, 0, 190))
- draw.SimpleText(server, "valfunde_hud_32", ScrW() / 5.5, ScrH() - 160, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER)
- draw.SimpleText(tname.." : "..name, "valfunde_hud_24", ScrW() / 9, ScrH() - 122.5, Color(255, 255, 255, 255), TEXT_ALIGN_LEFT)
- draw.SimpleText(thealth.." : "..health.." ("..armor..")", "valfunde_hud_24", ScrW() / 9, ScrH() - 100.5, Color(255, 255, 255, 255), TEXT_ALIGN_LEFT)
- draw.SimpleText(tenergy.." : "..energy, "valfunde_hud_24", ScrW() / 9, ScrH() - 78.5, Color(255, 255, 255, 255), TEXT_ALIGN_LEFT)
- draw.SimpleText(tmoney.." : "..money.." ("..salary..")", "valfunde_hud_24", ScrW() / 9, ScrH() - 56.5, Color(255, 255, 255, 255), TEXT_ALIGN_LEFT)
- surface.SetDrawColor(255, 255, 255, 255)
- surface.DrawLine(ScrW() / 5.5 - 80, ScrH() - 125, ScrW() / 5.5 + 80, ScrH() - 125)
- end)
- --[[-------------------------------------------------------------------------
- Show Playermodel on HUD
- ---------------------------------------------------------------------------]]
- hook.Add( "InitPostEntity", "pm_show", function()
- local pm_show = vgui.Create("DModelPanel")
- pm_show:SetPos(20, ScrH() - 154)
- pm_show:SetSize(ScrW() / 11, 134)
- pm_show:SetModel(LocalPlayer():GetModel())
- pm_show:SetCamPos(Vector(30, -15, 60))
- pm_show:SetFOV(55)
- pm_show:SetLookAt(Vector(0, 0, 60))
- pm_show.Think = function()
- if not LocalPlayer():Alive() then
- pm_show:SetSize(0, 0)
- else
- pm_show:SetSize(ScrW() / 11, 134)
- end
- pm_show:SetModel(LocalPlayer():GetModel())
- end
- pm_show.LayoutEntity = function()
- return false
- end
- end)
- --[[-------------------------------------------------------------------------
- Starting Agenda design
- ---------------------------------------------------------------------------]]
- local agendaText
- local function DrawAgenda()
- local agenda = LocalPlayer():getAgendaTable()
- if not agenda then return end
- agendaText = agendaText or DarkRP.textWrap( ( LocalPlayer():getDarkRPVar( "agenda" ) or "" ):gsub( "//", "\n" ):gsub( "\\n", "\n" ), "valfunde_hud_26", 440 )
- draw.RoundedBox( 0, 10, 10, 465, 115, Color(0, 0, 0, 190))
- draw.RoundedBox(0, 14, 44, 457, 77, Color(0, 0, 0, 150))
- draw.RoundedBox( 0, 10, 10, 465, 30, Color(0, 0, 0, 205))
- draw.DrawText( agenda.Title, "valfunde_hud_24", 240, 15, Color( 225, 225, 225, 255 ), 1 )
- draw.DrawText( agendaText, "valfunde_hud_24", 20, 44, Color( 225, 225, 225, 255 ) )
- end
- hook.Add( "HUDPaint", "DrawAgenda", DrawAgenda )
- hook.Add( "DarkRPVarChanged", "AgendaUpdate", function( ply, var, _, new )
- if ply != LocalPlayer() then return end
- if var == "agenda" and new then
- agendaText = DarkRP.textWrap( new:gsub( "//", "\n" ):gsub( "\\n", "\n" ), "valfunde_hud_26", 440 )
- else
- agendaText = nil
- end
- end )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement