Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*-----------------------------------------------------------
- Material HUD
- Copyright © 2015 Szymon (Szymekk) Jankowski
- All Rights Reserved
- Steam: https://steamcommunity.com/id/szymski
- -------------------------------------------------------------*/
- if SERVER then
- AddCSLuaFile()
- AddCSLuaFile("mathud_config.lua")
- CreateConVar("mhud_ver", 1, FCVAR_NOTIFY)
- resource.AddFile("materials/mathud/heart.png")
- resource.AddFile("materials/mathud/armor.png")
- resource.AddFile("materials/mathud/hunger.png")
- resource.AddFile("materials/mathud/money.png")
- resource.AddFile("materials/mathud/warning.png")
- resource.AddFile("materials/mathud/menu.png")
- resource.AddFile("materials/mathud/info.png")
- resource.AddFile("materials/mathud/mic.png")
- resource.AddFile("materials/mathud/speak.png")
- resource.AddFile("materials/shadow/u.png")
- resource.AddFile("materials/shadow/l.png")
- resource.AddFile("materials/shadow/r.png")
- resource.AddFile("materials/shadow/d.png")
- resource.AddFile("materials/shadow/lu.png")
- resource.AddFile("materials/shadow/ru.png")
- resource.AddFile("materials/shadow/ld.png")
- resource.AddFile("materials/shadow/rd.png")
- return
- end
- include("mathud_config.lua")
- local Config = MHUDConfig
- /*------------------------------------
- Hiding default HUD
- --------------------------------------*/
- local hidden = { "DarkRP_LocalPlayerHUD", "DarkRP_HUD", "DarkRP_Hungermod", "CHudHealth",}
- hook.Add("HUDShouldDraw", "MHUD_Hide", function(name)
- if table.HasValue(hidden, name) || (name == "DarkRP_EntityDisplay" && Config.HeadHUD) then return false end
- end)
- /*--------------------------------
- Useful
- ----------------------------------*/
- local function StencilStart()
- render.ClearStencil()
- render.SetStencilEnable( true )
- render.SetStencilWriteMask( 1 )
- render.SetStencilTestMask( 1 )
- render.SetStencilFailOperation( STENCILOPERATION_KEEP )
- render.SetStencilZFailOperation( STENCILOPERATION_KEEP )
- render.SetStencilPassOperation( STENCILOPERATION_REPLACE )
- render.SetStencilCompareFunction( STENCILCOMPARISONFUNCTION_ALWAYS )
- render.SetStencilReferenceValue( 1 )
- render.SetColorModulation( 1, 1, 1 )
- end
- local function StencilReplace()
- render.SetStencilCompareFunction( STENCILCOMPARISONFUNCTION_EQUAL )
- render.SetStencilPassOperation( STENCILOPERATION_REPLACE )
- render.SetStencilReferenceValue(0)
- end
- local function StencilEnd()
- render.SetStencilEnable( false )
- end
- local MatGradientUp = Material("vgui/gradient-u")
- local MatGradientDown = Material("vgui/gradient-d")
- local MatBlur = Material("pp/blurscreen")
- local MatHealth = Material("mathud/heart.png", "unlitgeneric")
- local MatArmor = Material("mathud/armor.png", "unlitgeneric")
- local MatHunger = Material("mathud/hunger.png", "unlitgeneric")
- local MatMoney = Material("mathud/money.png", "unlitgeneric")
- local MatWarning = Material("mathud/warning.png", "unlitgeneric")
- local MatMenu = Material("mathud/menu.png", "unlitgeneric")
- local MatInfo = Material("mathud/info.png", "unlitgeneric")
- local MatMic = Material("mathud/mic.png", "unlitgeneric")
- local MatSpeak = Material("mathud/speak.png", "unlitgeneric")
- local SU = Material("shadow/u.png", "unlitgeneric")
- local SL = Material("shadow/l.png", "unlitgeneric")
- local SR = Material("shadow/r.png", "unlitgeneric")
- local SD = Material("shadow/d.png", "unlitgeneric")
- local SLU = Material("shadow/lu.png", "unlitgeneric")
- local SRU = Material("shadow/ru.png", "unlitgeneric")
- local SLD = Material("shadow/ld.png", "unlitgeneric")
- local SRD = Material("shadow/rd.png", "unlitgeneric")
- surface.CreateFont("mhud_name", {
- font = "Roboto",
- size = 24,
- weight = 5000,
- blursize = 0,
- scanlines = 0,
- antialias = true,
- })
- surface.CreateFont("mhud_ammo", {
- font = "Roboto",
- size = 22,
- weight = 5000,
- blursize = 0,
- scanlines = 0,
- antialias = true,
- })
- surface.CreateFont("mhud_ammo_big", {
- font = "Roboto",
- size = 30,
- weight = 5000,
- blursize = 0,
- scanlines = 0,
- antialias = true,
- })
- surface.CreateFont("mhud_names", {
- font = "Roboto",
- size = 19,
- weight = 5000,
- blursize = 0,
- scanlines = 0,
- antialias = true,
- })
- surface.CreateFont("mhud_job", {
- font = "Roboto",
- size = 18,
- weight = 100,
- blursize = 0,
- scanlines = 0,
- antialias = true,
- })
- surface.CreateFont("mhud_mtext", {
- font = "Roboto",
- size = 19,
- weight = 5000,
- blursize = 0,
- scanlines = 0,
- antialias = true,
- })
- surface.CreateFont("mhud_ename", {
- font = "Roboto",
- size = 48,
- weight = 5000,
- blursize = 0,
- scanlines = 0,
- antialias = true,
- })
- surface.CreateFont("mhud_enameb", {
- font = "Roboto",
- size = 48,
- weight = 5000,
- blursize = 5,
- scanlines = 0,
- antialias = true,
- })
- surface.CreateFont("mhud_ejob", {
- font = "Roboto",
- size = 38,
- weight = 5000,
- blursize = 0,
- scanlines = 0,
- antialias = true,
- })
- surface.CreateFont("mhud_ejobb", {
- font = "Roboto",
- size = 38,
- weight = 5000,
- blursize = 5,
- scanlines = 0,
- antialias = true,
- })
- local function DrawSimpleCircle(posx, posy, radius, color)
- local poly = { }
- local v = 40
- for i = 0, v do
- poly[i+1] = {x = math.sin(-math.rad(i/v*360)) * radius + posx, y = math.cos(-math.rad(i/v*360)) * radius + posy}
- end
- draw.NoTexture()
- surface.SetDrawColor(color)
- surface.DrawPoly(poly)
- end
- local function DrawCircle(posx, posy, radius, progress, color)
- local poly = { }
- local v = 220
- poly[1] = {x = posx, y = posy}
- for i = 0, v*progress+0.5 do
- poly[i+2] = {x = math.sin(-math.rad(i/v*360)) * radius + posx, y = math.cos(-math.rad(i/v*360)) * radius + posy}
- end
- draw.NoTexture()
- surface.SetDrawColor(color)
- surface.DrawPoly(poly)
- end
- local function DrawCircleGradient(posx, posy, radius, progress, color)
- local poly = { }
- local v = 100
- poly[1] = {x = posx, y = posy}
- for i = 0, v*progress do
- poly[i+2] = {x = math.sin(-math.rad(i/v*360)) * radius + posx, y = math.cos(-math.rad(i/v*360)) * radius + posy}
- poly[i+2].u = 0
- poly[i+2].v = 0.6
- end
- surface.SetMaterial(MatGradientDown)
- surface.SetDrawColor(Color(0,0,0,200))
- surface.DrawPoly(poly)
- end
- local function DrawBlur(panel, x2, y2, w2, h2, layers, density, alpha)
- local x, y = panel:LocalToScreen(0, 0)
- surface.SetDrawColor( 255, 255, 255, alpha )
- surface.SetMaterial( MatBlur )
- for i = 1, 3 do
- MatBlur:SetFloat( "$blur", ( i / layers ) * density )
- MatBlur:Recompute()
- render.UpdateScreenEffectTexture()
- surface.DrawTexturedRect( -x, -y, ScrW(), ScrH() )
- end
- end
- local function DrawMatShadowC(x, y, w, h, left, top, right, bottom, cs)
- surface.SetDrawColor(255, 255, 255, 255)
- local s = cs or 16
- if top then
- local m = {
- {x = x, y = y-s, u = 0, v = 0},
- {x = x+w, y = y-s, u = 1/w/1024, v = 0},
- {x = x+w, y = y-s+s, u = 1/w/1024, v = 1},
- {x = x, y = y-s+s, u = 0, v = 1},
- }
- surface.SetMaterial(SU)
- surface.DrawPoly(m)
- end
- if right then
- local m = {
- {x = x+w, y = y, u = 0, v = 0},
- {x = x+w+s, y = y, u = 1, v = 0},
- {x = x+w+s, y = y+h, u = 1, v = 1/h/1024},
- {x = x+w, y = y+h, u = 0, v = 1/h/1024},
- }
- surface.SetMaterial(SR)
- surface.DrawPoly(m)
- end
- if bottom then
- local m = {
- {x = x, y = y+h, u = 0, v = 0},
- {x = x+w, y = y+h, u = 1/w/1024, v = 0},
- {x = x+w, y = y+h+s, u = 1/w/1024, v = 1},
- {x = x, y = y+h+s, u = 0, v = 1},
- }
- surface.SetMaterial(SD)
- surface.DrawPoly(m)
- end
- if left then
- local m = {
- {x = x-s, y = y, u = 0, v = 0},
- {x = x-s+s, y = y, u = 1, v = 0},
- {x = x-s+s, y = y+h, u = 1, v = 1/h/1024},
- {x = x-s, y = y+h, u = 0, v = 1/h/1024},
- }
- surface.SetMaterial(SL)
- surface.DrawPoly(m)
- end
- end
- local function DrawMatShadow(x, y, w, h)
- surface.SetDrawColor(255, 255, 255, 255)
- local m = {
- {x = x, y = y-16, u = 0, v = 0},
- {x = x+w, y = y-16, u = 1/w/1024, v = 0},
- {x = x+w, y = y-16+16, u = 1/w/1024, v = 1},
- {x = x, y = y-16+16, u = 0, v = 1},
- }
- surface.SetMaterial(SU)
- surface.DrawPoly(m)
- //surface.DrawTexturedRect(x, y-16, w, 16)
- local m = {
- {x = x+w, y = y, u = 0, v = 0},
- {x = x+w+16, y = y, u = 1, v = 0},
- {x = x+w+16, y = y+h, u = 1, v = 1/h/1024},
- {x = x+w, y = y+h, u = 0, v = 1/h/1024},
- }
- surface.SetMaterial(SR)
- surface.DrawPoly(m)
- //surface.DrawTexturedRect(x+w, y, 16, h)
- local m = {
- {x = x, y = y+h, u = 0, v = 0},
- {x = x+w, y = y+h, u = 1/w/1024, v = 0},
- {x = x+w, y = y+h+16, u = 1/w/1024, v = 1},
- {x = x, y = y+h+16, u = 0, v = 1},
- }
- surface.SetMaterial(SD)
- surface.DrawPoly(m)
- //surface.DrawTexturedRect(x, y+h, w, 16)
- local m = {
- {x = x-16, y = y, u = 0, v = 0},
- {x = x-16+16, y = y, u = 1, v = 0},
- {x = x-16+16, y = y+h, u = 1, v = 1/h/1024},
- {x = x-16, y = y+h, u = 0, v = 1/h/1024},
- }
- surface.SetMaterial(SL)
- surface.DrawPoly(m)
- //surface.DrawTexturedRect(x-16, y, 16, h)
- surface.SetMaterial(SLU)
- surface.DrawTexturedRect(x-16, y-16, 16, 16)
- surface.SetMaterial(SRU)
- surface.DrawTexturedRect(x+w, y-16, 16, 16)
- surface.SetMaterial(SRD)
- surface.DrawTexturedRect(x+w, y+h, 16, 16)
- surface.SetMaterial(SLD)
- surface.DrawTexturedRect(x-16, y+h, 16, 16)
- end
- local function DrawMatBox(x, y, w, h, col)
- surface.SetDrawColor(col)
- surface.DrawRect(x, y, w, h)
- end
- local function DrawMatBoxS(x, y, w, h, col)
- surface.SetDrawColor(col)
- //surface.DrawRect(x, y, w, h)
- draw.RoundedBox(4, x, y, w, h, col)
- DrawMatShadow(x, y, w, h)
- end
- /*------------------------------------
- Panel vars
- --------------------------------------*/
- MHUD = MHUD or nil
- MHUDA = MHUDA or nil
- MHUDAg = MHUDAg or nil
- local HP = 0
- local Armor = 0
- local Hunger = 0
- local Ammo = 0
- local MaxAmmo = { }
- /*------------------------------------
- Panel creation
- --------------------------------------*/
- local function CreateHUDPanel()
- if IsValid(MHUD) then
- MHUD:Remove()
- end
- if IsValid(MHUDA) then
- MHUDA:Remove()
- end
- if IsValid(MHUDAg) then
- MHUDAg:Remove()
- end
- // Main parent
- MHUD = vgui.Create("DPanel")
- MHUD:SetSize(380, 220)
- MHUD:SetPos(5, ScrH() - MHUD:GetTall() - 5)
- MHUD:ParentToHUD()
- MHUD:SetExpensiveShadow(10, Color(0,0,0,255))
- function MHUD:Paint(w, h)
- DrawMatBoxS(16, 16, w-32, h-32, Config.BgColor)
- end
- // Bar
- local bar = MHUD:Add("DPanel")
- bar:Dock(TOP)
- bar:SetHeight(64)
- function bar:Paint(w, h)
- DrawMatBox(16, 16, w-32, h-32, Config.BarColor)
- DrawMatShadowC(16, 16, w-32, h-32, false, false, false, true, 4)
- DrawMatShadowC(16, 16, w-32, h-32, false, false, false, true, 4)
- surface.SetDrawColor(255, 255, 255)
- surface.SetMaterial(MatMenu)
- surface.DrawTexturedRect(16, 16, 32, 32)
- if LocalPlayer():getDarkRPVar("wanted") then
- surface.SetDrawColor(244, 67, 54)
- surface.SetMaterial(MatWarning)
- surface.DrawTexturedRect(w-16-24-8, 16, 32, 32)
- end
- end
- // Avatar box
- local avatarbox = MHUD:Add("DPanel")
- avatarbox:SetWide(152)
- avatarbox:DockMargin(16,-16,0,16)
- avatarbox:Dock(LEFT)
- function avatarbox:Paint(w, h)
- DrawMatShadowC(0, 0, w-4, h, false, false, true, false, 4)
- DrawMatShadowC(0, 0, w-4, h, false, false, true, false, 4)
- end
- // Avatar
- local avatar = avatarbox:Add("AvatarImage")
- avatar:SetSize( 72, 72 )
- avatar:SetPlayer(LocalPlayer(), 128)
- avatar:SetPos(16+16, avatar:GetParent():GetTall()/2)
- avatar:CenterHorizontal()
- function avatar:PaintOver(w, h)
- StencilStart()
- DrawCircle(w/2, h/2, w/2, 1, Color(0,0,0,1))
- StencilReplace()
- surface.SetDrawColor(Config.BgColor)
- surface.DrawRect(0, 0, w, h)
- StencilEnd()
- end
- function avatar:Think()
- avatar:SetPos(16+16, avatar:GetParent():GetTall()/2 - 72/2 - 20)
- avatar:CenterHorizontal()
- end
- // Name
- local name = avatarbox:Add("DLabel")
- name:SetColor(Config.TextColor)
- name:SetFont("mhud_name")
- name:SetSize( name:GetParent():GetWide(), 32)
- name:SetPos(16+16, name:GetParent():GetTall()/2 + 72/2 + 14)
- name:CenterHorizontal()
- name:SetContentAlignment(5)
- function name:Think()
- name:SetPos(16+16, name:GetParent():GetTall()/2 + 72/2 - 22)
- name:CenterHorizontal()
- name:SetContentAlignment(5)
- name:SetText(LocalPlayer():Name())
- end
- // Job
- local job = avatarbox:Add("DLabel")
- job:SetColor(Config.TextColor)
- job:SetFont("mhud_job")
- job:SetSize( job:GetParent():GetWide(), 32)
- job:SetPlayer(LocalPlayer(), 128)
- job:SetPos(16+16, job:GetParent():GetTall()/2 + 72/2 + 14)
- job:CenterHorizontal()
- job:SetContentAlignment(5)
- function job:Think()
- job:SetPos(16+16, job:GetParent():GetTall()/2 + 72/2 - 2)
- job:CenterHorizontal()
- job:SetContentAlignment(5)
- job:SetText(LocalPlayer():getDarkRPVar("job") or "")
- end
- // Right box
- local rbox = MHUD:Add("DPanel")
- rbox:SetWide(152)
- rbox:DockMargin(-4,-16,16,16)
- rbox:Dock(FILL)
- function rbox:Paint(w, h) end
- local function MakeEntry()
- local entry = rbox:Add("DPanel")
- entry:DockMargin(8, LocalPlayer():getDarkRPVar("Energy") and 4 or 6, 8, LocalPlayer():getDarkRPVar("Energy") and -12 or 0)
- entry:SetTall(32)
- entry:Dock(TOP)
- function entry:Paint(w, h) end
- local img = entry:Add("DPanel")
- img:SetSize(32, 32)
- img:Dock(LEFT)
- function img:Paint(w, h)
- surface.SetDrawColor(entry.color1)
- surface.SetMaterial(entry.mat)
- surface.DrawTexturedRect(0, 0, w, h)
- end
- local pbar = entry:Add("DPanel")
- entry.aprog = 0
- pbar:SetSize(128,4)
- pbar:DockMargin(8, 14, 8, 14)
- pbar:Dock(FILL)
- function pbar:Paint(w, h)
- surface.SetDrawColor(entry.color2)
- surface.DrawRect(0, 0, w, h)
- surface.SetDrawColor(entry.color1)
- surface.DrawRect(0, 0, w*(math.Clamp(entry.aprog or 0, 0, 1)), h)
- end
- function pbar:Think()
- entry.aprog = Lerp(FrameTime()*10, entry.aprog, entry.prog)
- end
- return entry
- end
- local lastHP = 100
- local animHP = 0
- local toAdd = 0
- local maxHP = 100
- local hpEntry = MakeEntry()
- hpEntry.color1 = Config.HPColor1
- hpEntry.color2 = Config.HPColor2
- hpEntry.mat = MatHealth
- function hpEntry:Think()
- maxHP = math.max(maxHP, LocalPlayer():Health())
- toAdd = 20*math.sin(math.Clamp(animHP-RealTime(), 0, 9000)*20)
- self.prog = LocalPlayer():Health() / maxHP
- self.color1 = Color(Config.HPColor1.r+toAdd,Config.HPColor1.g+toAdd,Config.HPColor1.b+toAdd)
- self.color2 = Color(Config.HPColor2.r+toAdd,Config.HPColor2.g+toAdd,Config.HPColor2.b+toAdd)
- if LocalPlayer():Health() < lastHP then
- animHP = RealTime() + 4
- end
- lastHP = LocalPlayer():Health()
- end
- local lastArmor = 0
- local animArmor = 0
- local toAdd = 0
- local armorEntry = MakeEntry()
- armorEntry.color1 = Config.ArmorColor1
- armorEntry.color2 = Config.ArmorColor2
- armorEntry.mat = MatArmor
- function armorEntry:Think()
- toAdd = 20*math.sin(math.Clamp(animArmor-RealTime(), 0, 9000)*20)
- self.prog = LocalPlayer():Armor() / 100
- self.color1 = Color(Config.ArmorColor1.r+toAdd,Config.ArmorColor1.g+toAdd,Config.ArmorColor1.b+toAdd)
- self.color2 = Color(Config.ArmorColor2.r+toAdd,Config.ArmorColor2.g+toAdd,Config.ArmorColor2.b+toAdd)
- if LocalPlayer():Armor() < lastArmor then
- animArmor = RealTime() + 4
- end
- lastArmor = LocalPlayer():Armor()
- end
- if LocalPlayer():getDarkRPVar("Energy") then
- local hungerEntry = MakeEntry()
- hungerEntry.color1 = Config.HungerColor1
- hungerEntry.color2 = Config.HungerColor2
- hungerEntry.mat = MatHunger
- function hungerEntry:Think()
- self.prog = (LocalPlayer():getDarkRPVar("Energy") or 60)/100
- end
- end
- // Money box
- local mbox = rbox:Add("DPanel")
- mbox:SetWide(152)
- mbox:DockMargin(-4, 0, 0, 0)
- mbox:SetTall(72)
- mbox:Dock(BOTTOM)
- function mbox:Paint(w, h)
- DrawMatShadowC(0, 4, w, h, false, true, false, false, 2)
- DrawMatShadowC(0, 4, w, h, false, true, false, false, 2)
- end
- // Microphone
- local mic = mbox:Add("DPanel")
- mic:SetSize(64,64)
- function mic:Think()
- mic:SetPos(mbox:GetWide()-64-2, mbox:GetTall()-64-2)
- end
- local micAnim = 0
- function mic:Paint(w, h)
- surface.SetDrawColor(Color(Config.TextColor.r,Config.TextColor.g,Config.TextColor.b,255*math.Clamp(micAnim,0,1)))
- surface.SetMaterial(MatMic)
- surface.DrawTexturedRect(0, 0, w, h)
- if LocalPlayer():IsSpeaking() then
- micAnim = Lerp(FrameTime()*2, micAnim, 5)
- else
- micAnim = Lerp(FrameTime()*5, micAnim, 0)
- end
- end
- // Bars
- local function MakeEntry()
- local entry = mbox:Add("DPanel")
- entry:DockMargin(12,6,8,-6)
- entry:SetTall(32)
- entry:Dock(TOP)
- function entry:Paint(w, h) end
- local img = entry:Add("DPanel")
- img:SetSize(32, 32)
- img:Dock(LEFT)
- function img:Paint(w, h)
- surface.SetDrawColor(entry.color1)
- surface.SetMaterial(entry.mat)
- surface.DrawTexturedRect(0, 0, w, h)
- end
- local text = entry:Add("DLabel")
- entry.text = text
- text:SetFont("mhud_mtext")
- text:SetSize(128,2)
- text:DockMargin(8, 2, 16, 2)
- text:Dock(FILL)
- text:SetColor(entry.color1)
- text:SetContentAlignment(4)
- return entry
- end
- local moneyEntry = MakeEntry()
- moneyEntry.color1 = Config.MoneyColor
- moneyEntry.mat = MatMoney
- moneyEntry.text:SetColor(Config.MoneyColor)
- function moneyEntry:Think()
- self.text:SetText(DarkRP.formatMoney(LocalPlayer():getDarkRPVar("money")))
- end
- local salaryEntry = MakeEntry()
- salaryEntry.color1 = Config.SalaryColor
- salaryEntry.mat = MatMoney
- salaryEntry.text:SetColor(Config.SalaryColor)
- function salaryEntry:Think()
- self.text:SetText(DarkRP.formatMoney(LocalPlayer():getDarkRPVar("salary")))
- end
- end
- /*------------------------------------
- Entity Display
- --------------------------------------*/
- local function DrawEntityDisplay()
- local shootPos = LocalPlayer():GetShootPos()
- local aimVec = LocalPlayer():GetAimVector()
- for k, ply in pairs(players or player.GetAll()) do
- if ply == LocalPlayer() or not ply:Alive() or ply:GetNoDraw() then continue end
- local hisPos = ply:GetShootPos()
- if ply:getDarkRPVar("wanted") && ply.drawWantedInfo then ply:drawWantedInfo() end
- if hisPos:DistToSqr(shootPos) < 100000 then
- local pos = hisPos - shootPos
- local unitPos = pos:GetNormalized()
- if unitPos:Dot(aimVec) > 0.95 then
- local trace = util.QuickTrace(shootPos, pos, LocalPlayer())
- if trace.Hit and trace.Entity ~= ply then return end
- local pos = (ply:EyePos()+Vector(0,0,15)):ToScreen()
- pos.y = pos.y - 90
- if ply:IsSpeaking() then
- surface.SetMaterial(MatSpeak)
- surface.SetDrawColor(Config.SpeakColor)
- surface.DrawTexturedRect(pos.x - 64, pos.y - 64 - 50, 128, 128)
- end
- draw.DrawText(ply:Name(), "mhud_enameb", pos.x, pos.y, Color(0,0,0), 1)
- local a, b, c = ColorToHSV(team.GetColor(ply:Team()))
- draw.DrawText(ply:Name(), "mhud_ename", pos.x, pos.y, HSVToColor(a,b*0.8,0.9), 1)
- draw.DrawText(ply:getDarkRPVar("job") or "", "mhud_ejobb", pos.x, pos.y + 40, Color(0,0,0), 1)
- draw.DrawText(ply:getDarkRPVar("job") or "", "mhud_ejob", pos.x, pos.y + 40, Color(255,255,255), 1)
- local w, h = 100, 4
- surface.SetDrawColor(Config.EntHPColor2)
- surface.DrawRect(pos.x - w/2, pos.y + 90, w, h)
- surface.SetDrawColor(Config.EntHPColor1)
- surface.DrawRect(pos.x - w/2, pos.y + 90, w*math.Clamp(ply:Health()/100,0,1), h)
- end
- end
- end
- local tr = LocalPlayer():GetEyeTrace()
- if IsValid(tr.Entity) and tr.Entity:isKeysOwnable() and tr.Entity:GetPos():Distance(LocalPlayer():GetPos()) < 200 then
- tr.Entity:drawOwnableInfo()
- end
- end
- local AdminTell = function() end
- usermessage.Hook("AdminTell", function(msg)
- timer.Destroy("DarkRP_AdminTell")
- local Message = msg:ReadString()
- AdminTell = function()
- draw.RoundedBox(4, 10, 10, Scrw - 20, 110, colors.darkblack)
- draw.DrawNonParsedText(DarkRP.getPhrase("listen_up"), "GModToolName", Scrw / 2 + 10, 10, colors.white, 1)
- draw.DrawNonParsedText(Message, "ChatFont", Scrw / 2 + 10, 90, colors.brightred, 1)
- end
- timer.Create("DarkRP_AdminTell", 10, 1, function()
- AdminTell = function() end
- end)
- end)
- hook.Add("HUDPaint", "MHUDEntityDisplay", function()
- if Config.HeadHUD then
- DrawEntityDisplay()
- end
- //AdminTell()
- end)
- /*------------------------------------
- HUD Loading
- --------------------------------------*/
- local function HideMic()
- local mat, mat2, mat3, mat4, bt
- mat = Material( "invisible" )
- bt = mat:GetMaterialTexture( "$basetexture" )
- mat2 = Material( "voice/icntlk_local" )
- mat3 = Material( "voice/icntlk_sv" )
- mat4 = Material( "voice/icntlk_pl" )
- mat2:SetMaterialTexture( "$basetexture", bt )
- mat3:SetMaterialTexture( "$basetexture", bt )
- mat4:SetMaterialTexture( "$basetexture", bt )
- end
- //hook.Add("Initialize", "MHUDHideMic", HideMic)
- if MHUD then
- CreateHUDPanel()
- end
- hook.Add("InitPostEntity", "MHUDInit", function()
- CreateHUDPanel()
- end)
- hook.Add("Tick", "MHUDTick", function()
- if Config != MHUDConfig then
- Config = MHUDConfig
- CreateHUDPanel()
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement