Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- surface.CreateFont( "hud_font_24", { font = "DermaDefault", size = 24, weight = 600, bold = true, strikeout = false, outline = false, shadow = false, outline = false,})
- surface.CreateFont( "hud_font_18", { font = "DermaDefault", size = 18, weight = 600, bold = true, strikeout = false, outline = false, shadow = false, outline = false,})
- surface.CreateFont( "hud_font_14", { font = "DermaDefault", size = 14, weight = 600, bold = true, strikeout = false, outline = false, shadow = false, outline = false,})
- local backgroundColor = Color(5, 181, 240, 255)
- local foregroundColor = Color(0,0,0,255)
- local hungerColor
- local scrw = ScrW()
- local scrh = ScrH()
- local hudW = 400
- local hudH = 150
- local function DrawCustomHUD()
- --
- --
- -- some shit you don't need
- --
- --
- if !DermaShown then
- PlayerIcon = vgui.Create("DModelPanel")
- PlayerIcon:SetModel(LocalPlayer():GetModel())
- function PlayerIcon:LayoutEntity( Entity ) return end
- PlayerIcon:SetAnimated(False)
- PlayerIcon:SetPos(40 + 2, scrh - hudH - 20 + 4 + 15 + 2)
- PlayerIcon:SetSize(hudH - 44, hudH - 44)
- PlayerIcon:SetCamPos( Vector( 16, -4, 65))
- PlayerIcon:SetLookAt( Vector( 0, 0, 66.5 ) )
- DermaShown = true
- end
- if IsValid(PlayerIcon) then
- if PlayerIcon:GetModel() == nil or PlayerIcon:GetModel() != LocalPlayer():GetModel() then
- PlayerIcon:SetModel(LocalPlayer():GetModel() or "models/props_junk/watermelon01.mdl")
- end
- end
- end
- hook.Add("HUDPaint", "DrawCustomHUD", DrawCustomHUD)
- local function drawBaseHUD()
- surface.SetDrawColor(backgroundColor)
- surface.DrawRect(20, scrh - hudH - 20, hudW, hudH)
- surface.SetDrawColor(foregroundColor)
- surface.DrawRect(20 + 4, scrh - hudH - 20 + 4, hudW - 8, hudH - 8)
- surface.SetDrawColor(color_white)
- surface.DrawRect(40, scrh - hudH - 20 + 4 + 15, hudH - 40, hudH - 40)
- surface.SetDrawColor(foregroundColor)
- surface.DrawRect(40 + 2, scrh - hudH - 20 + 4 + 15 + 2, hudH - 40 - 4, hudH - 40 - 4)
- end
- local function drawPlayerInfo()
- local ply = LocalPlayer()
- draw.SimpleText("Name: " .. ply:Name(), "hud_font_18", hudH + 10, scrh - hudH + 10, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
- draw.SimpleText("Credits: " .. DarkRP.formatMoney(ply:getDarkRPVar("money")), "hud_font_18", hudH + 10, scrh - hudH + 30, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
- draw.SimpleText("Job: " .. team.GetName(ply:Team()), "hud_font_18", hudH + 10, scrh - hudH + 50, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
- end
- local function drawPlayerStats()
- local ply = LocalPlayer()
- if ply:getDarkRPVar("xp") then
- local xp = ply:getDarkRPVar("xp")
- local maxXP = (((10+(((ply:getDarkRPVar('level') or 1)*((ply:getDarkRPVar('level') or 1)+1)*90))))*LevelSystemConfiguration.XPMult)
- local level = ply:getDarkRPVar("level")
- surface.SetDrawColor(backgroundColor)
- surface.DrawRect(20, scrh - hudH - hudH / 3 - 25, hudW, hudH / 3)
- surface.SetDrawColor(foregroundColor)
- surface.DrawRect(20 + 4, scrh - hudH - hudH / 3 - 25 + 4, hudW - 8, hudH / 3 - 8)
- --XP:
- draw.SimpleText("Level " .. level .. " ".. math.Round((xp / maxXP) * 100) .." %", "hud_font_18", 20 + 4 + hudW / 2, scrh - hudH - hudH / 3 - 10, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
- surface.SetDrawColor(100, 100, 100, 255)
- surface.DrawRect(20 + 4 + 5, scrh - hudH - hudH / 3.5 - hudH * .05, hudW - 8 - 10, hudH * .1)
- surface.SetDrawColor(255,255,255,255)
- surface.DrawRect(20 + 4 + 5 + 4, scrh - hudH - hudH / 3.5 - hudH * .05 + 4, (hudW - 8 - 10 - 8) * (xp / maxXP) , hudH * .1 - 8)
- end
- --Health:
- surface.SetDrawColor(255,90,90,50)
- surface.DrawRect(hudH + 20, scrh - hudH + 70, (hudW - hudH - 20), 10)
- surface.SetDrawColor(255,90,90,255)
- surface.DrawRect(hudH + 20, scrh - hudH + 70, (hudW - hudH - 20) * (math.Clamp(ply:Health(), 0, 100) / ply:GetMaxHealth()), 10)
- draw.SimpleText(ply:Health() .. " HP", "hud_font_14", hudH + 20 + (hudW - hudH - 20) / 2, scrh - hudH + 70 + 5, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
- --Armor:
- surface.SetDrawColor(80, 95, 191, 50)
- surface.DrawRect(hudH + 20, scrh - hudH + 85, (hudW - hudH - 20) , 10)
- surface.SetDrawColor(80, 95, 191, 255)
- surface.DrawRect(hudH + 20, scrh - hudH + 85, (hudW - hudH - 20) * (math.Clamp(ply:Armor(), 0, 100) / 100) , 10)
- draw.SimpleText(ply:Armor() .. " Armor", "hud_font_14", hudH + 20 + (hudW - hudH - 20) / 2, scrh - hudH + 85 + 5, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
- --Hunger:
- if ply:getDarkRPVar("Energy") != nil then
- surface.SetDrawColor(156, 123, 70, 50)
- surface.DrawRect(hudH + 20, scrh - hudH + 100, (hudW - hudH - 20), 10)
- surface.SetDrawColor(156, 123, 70, 255)
- surface.DrawRect(hudH + 20, scrh - hudH + 100, (hudW - hudH - 20) * (math.Clamp(ply:getDarkRPVar("Energy"), 0, 100) / 100) , 10)
- draw.SimpleText(math.Round(ply:getDarkRPVar("Energy")) .. "%", "hud_font_14", hudH + 20 + (hudW - hudH - 20) / 2, scrh - hudH + 100 + 5, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
- end
- end
- hook.Add("HUDPaint", "James_HUD", function()
- drawBaseHUD()
- drawPlayerInfo()
- drawPlayerStats()
- end)
- local hide = {
- CHudHealth = true,
- CHudBattery = true,
- CHudAmmo = true,
- }
- local hideHUDElements = {
- -- if you DarkRP_HUD this to true, ALL of DarkRP's HUD will be disabled. That is the health bar and stuff,
- -- but also the agenda, the voice chat icons, lockdown text, player arrested text and the names above players' heads
- ["DarkRP_HUD"] = false,
- -- DarkRP_EntityDisplay is the text that is drawn above a player when you look at them.
- -- This also draws the information on doors and vehicles
- ["DarkRP_EntityDisplay"] = false,
- -- DarkRP_ZombieInfo draws information about zombies for admins who use /showzombie.
- ["DarkRP_ZombieInfo"] = false,
- -- This is the one you're most likely to replace first
- -- DarkRP_LocalPlayerHUD is the default HUD you see on the bottom left of the screen
- -- It shows your health, job, salary and wallet, but NOT hunger (if you have hungermod enabled)
- ["DarkRP_LocalPlayerHUD"] = false,
- -- If you have hungermod enabled, you will see a hunger bar in the DarkRP_LocalPlayerHUD
- -- This does not get disabled with DarkRP_LocalPlayerHUD so you will need to disable DarkRP_Hungermod too
- ["DarkRP_Hungermod"] = true,
- -- Drawing the DarkRP agenda
- ["DarkRP_Agenda"] = false
- }
- -- this is the code that actually disables the drawing.
- hook.Add("HUDShouldDraw", "HideDefaultDarkRPHud", function(name)
- if hideHUDElements[name] then return false end
- end)
- hook.Add( "HUDShouldDraw", "HideHUD", function( name )
- if ( hide[ name ] ) then return false end
- -- Don't return anything here, it may break other addons that rely on this hook.
- end )
- hook.Add("HUDDrawTargetID", "NoTargetID", function()
- return false
- end)
- local function DisplayNotify(msg)
- local txt = msg:ReadString()
- GAMEMODE:AddNotify(txt, msg:ReadShort(), msg:ReadLong())
- surface.PlaySound("buttons/lightswitch2.wav")
- MsgC(Color(255, 20, 20, 255), "[DarkRP] ", Color(200, 200, 200, 255), txt, "\n")
- end
- usermessage.Hook("_Notify", DisplayNotify)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement