• DarkRP HUD - Nothing besides the HUD itself will display.
    0 replies, posted
I have an issue, basically nothing besides the HUD will display (Player Info above head, agenda, etc) Any help would be appreciated!! 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"] = true,     -- 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"] = true,     -- Lockdown info on the HUD     ["DarkRP_LockdownHUD"] = true,     -- Arrested HUD     ["DarkRP_ArrestedHUD"] = true,     ["CHudHealth"] = true,     ["CHudAmmo"] = true,     ["CHudSecondaryAmmo"] = true, } local ConVars = {} local HUDWidth local HUDHeight local Color = Color local CurTime = CurTime local cvars = cvars local DarkRP = DarkRP local draw = draw local GetConVar = GetConVar local hook = hook local IsValid = IsValid local Lerp = Lerp local localplayer local math = math local pairs = pairs local ScrW, ScrH = ScrW, ScrH local SortedPairs = SortedPairs local string = string local surface = surface local table = table local timer = timer local tostring = tostring local plyMeta = FindMetaTable("Player") local colors = {} colors.black = Color(0, 0, 0, 255) colors.blue = Color(0, 0, 255, 255) colors.brightred = Color(200, 30, 30, 255) colors.darkred = Color(0, 0, 70, 100) colors.darkblack = Color(0, 0, 0, 200) colors.gray1 = Color(0, 0, 0, 175) colors.gray2 = Color(51, 58, 51,100) colors.red = Color(255, 0, 0, 255) colors.white = Color(255, 255, 255, 255) colors.white1 = Color(255, 255, 255, 200) local function ReloadConVars()     ConVars = {         background = {0,0,0,100},         Healthbackground = {0,0,0,200},         Healthforeground = {140,0,0,180},         HealthText = {255,255,255,200},         Job1 = {0,0,150,200},         Job2 = {0,0,0,255},         salary1 = {0,150,0,200},         salary2 = {0,0,0,255}     }     for name, Colour in pairs(ConVars) do         ConVars[name] = {}         for num, rgb in SortedPairs(Colour) do             local CVar = GetConVar(name .. num) or CreateClientConVar(name .. num, rgb, true, false)             table.insert(ConVars[name], CVar:GetInt())             if not cvars.GetConVarCallbacks(name .. num, false) then                 cvars.AddChangeCallback(name .. num, function()                     timer.Simple(0, ReloadConVars)                 end)             end         end         ConVars[name] = Color(unpack(ConVars[name]))     end     HUDWidth = (GetConVar("HudW") or  CreateClientConVar("HudW", 240, true, false)):GetInt()     HUDHeight = (GetConVar("HudH") or CreateClientConVar("HudH", 115, true, false)):GetInt()     if not cvars.GetConVarCallbacks("HudW", false) and not cvars.GetConVarCallbacks("HudH", false) then         cvars.AddChangeCallback("HudW", function() timer.Simple(0,ReloadConVars) end)         cvars.AddChangeCallback("HudH", function() timer.Simple(0,ReloadConVars) end)     end end ReloadConVars() local Scrw, Scrh, RelativeX, RelativeY surface.CreateFont( "Apollo", {     font        = "Roboto-Light",     size        = 16,     weight      = 800, }) surface.CreateFont( "ApolloSmall",  {     font        = "Roboto-Light",     size        = 12,     weight      = 800, }) surface.CreateFont( "ApolloLarge", {     font        = "Roboto-Light",     size        = 17,     weight      = 800, })  local function Base()  -- Declaring Variables  local DrawHealth = LocalPlayer():Health() or 0  local lplayer = LocalPlayer() local TextHealth = LocalPlayer():Health() or 0  local DrawArmor = LocalPlayer():Armor() or 0  local TextArmor = LocalPlayer():Armor() or 0  local wallet = LocalPlayer():getDarkRPVar("money") local plysalary = LocalPlayer():getDarkRPVar("salary") or "Error"  local plyjob = LocalPlayer():getDarkRPVar("job") or "Error"  local plyenergy = LocalPlayer():getDarkRPVar("Energy") or "Error" local teamcolor = team.GetColor(lplayer:Team()) local plyjob = LocalPlayer():getDarkRPVar("job") -- If statements to fix the HP/Armor bars becoming too large. if DrawHealth > 100 then DrawHealth = 100 end  if DrawHealth < 0 then DrawHealth = 0 end  if DrawArmor > 100 then DrawArmor = 100 end if DrawArmor < 0 then DrawArmor = 0 end -- Creating Materials  local myid = Material( "blackline/id.png", "smooth" ) local Page = Material("icon16/page_white_text.png") local heart = Material( "blackline/heart.png", "smooth" ) local shield = Material( "blackline/shield.png", "smooth" ) local jobicon = Material( "blackline/briefcase.png", "smooth" ) local cmat = Material( "blackline/cash.png", "smooth" ) local cmat2 = Material( "blackline/cash2.png", "smooth" ) local burger = Material( "blackline/burger.png", "smooth" ) -- Drawing HUD Boxes      surface.SetFont("Apollo")     surface.SetTextColor(255, 255, 255, 255)     surface.SetDrawColor(25, 25, 25, 245)     surface.DrawRect(0, 0, ScrW() - 0, ScrH() / 30)                                    -- Main HUD box      surface.SetDrawColor(255, 255, 255, 255)                   -- Line seperation  -- Drawing Watermark     surface.SetTextPos(ScrW() - 115, ScrH() / 50 - 10)     surface.SetTextColor(0, 255, 0, 255)     surface.DrawText("Apollo Networks")                                                     surface.SetDrawColor(255, 255, 255, 255 )                                        surface.DrawOutlinedRect(ScrW() / 2000, ScrH() / 2000, ScrW() * 1, ScrH() / 30)    -- White border for HUD -- Drawing Job Name           local jobwidth, jobheight = surface.GetTextSize( plyjob )     if lplayer:getDarkRPVar("HasGunlicense") then          surface.SetDrawColor(255, 255, 255, 255)     surface.SetMaterial(Page)     surface.DrawTexturedRect(ScrW() / 1585 + 5, ScrH() / 130, ScrW() / 95, ScrH() / 50 )    -- Job Icon      else      surface.SetDrawColor(255, 255, 255, 25)     surface.SetMaterial(Page)     surface.DrawTexturedRect(ScrW() / 1585 + 5, ScrH() / 130, ScrW() / 95, ScrH() / 50 )      end           surface.SetDrawColor(255, 255, 255, 255)     surface.SetFont("Apollo")     surface.SetTextColor(255, 255, 255, 255)     surface.SetTextPos(ScrW() / 1000 + 130 - 100, ScrH() / 50 - 10)                                     -- Text position for job name     surface.DrawText(plyjob)     surface.DrawLine(jobwidth + 45, 0, jobwidth + 45, ScrH() / 30)                                                          -- Drawing job name     surface.SetDrawColor(255, 255, 255, 255)   -- Drawing Health     surface.SetTextPos(jobwidth + 75, ScrH() / 50 - 10)                                     -- Text position for drawing health.     surface.SetTextColor(255, 145, 145, 255)                                                   surface.DrawText(DrawHealth .. "%")     surface.SetDrawColor(255, 145, 145, 255)     surface.SetMaterial(heart)     surface.DrawTexturedRect(jobwidth + 50, ScrH() / 125, ScrW() / 1580 + 20, ScrH() / 50 )  -- Health Icon  -- Drawing Armor     surface.SetDrawColor(255, 255, 255, 255)     surface.SetTextPos(jobwidth + 146, ScrH() / 50 - 10)     surface.DrawLine(jobwidth + 120, 0, jobwidth + 120, ScrH() / 30)       surface.SetTextColor(155, 193, 255, 255)     surface.SetDrawColor(255, 255, 255, 255)     surface.DrawText(DrawArmor .. "%")     surface.DrawLine(jobwidth + 190, 0, jobwidth + 190, ScrH() / 30)     surface.SetDrawColor(155, 193, 255, 255)     surface.SetMaterial(shield)     surface.DrawTexturedRect(jobwidth + 125, ScrH() / 125, ScrW() / 85, ScrH() / 50 )    -- Armor Icon -- Drawing Energy        surface.SetDrawColor(255, 175, 0, 255)    surface.SetTextColor(255, 175, 0, 255)    surface.SetMaterial(burger)    surface.DrawTexturedRect(jobwidth + 198, ScrH() / 125, ScrW() / 85, ScrH() / 50)    surface.SetTextPos(jobwidth + 223, ScrH() / 50 - 10)    surface.DrawText(plyenergy .."%")    surface.SetDrawColor(255, 255, 255, 255)    surface.DrawLine(jobwidth + 267, 0, jobwidth + 267, ScrH() / 30) -- Drawing Wallet    surface.SetDrawColor(255, 255, 255, 255)    surface.SetTextColor(181, 255, 181, 255)        surface.SetTextPos(jobwidth + 277, ScrH() / 50 - 10)    surface.DrawText("$" .. string.Comma(wallet))     -- Drawing Agenda local agendaText local shouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_Agenda")     if shouldDraw == false then return end      local agenda = localplayer:getAgendaTable()     if not agenda then return end     agendaText = agendaText or DarkRP.textWrap((localplayer:getDarkRPVar("agenda") or""):gsub("//", "\n"):gsub("\\n", "\n"), "DarkRPHUD1", 440)     draw.RoundedBox(0, 5, 50, 460, 110, Color(25, 25, 25, 245))    -- draw.RoundedBox(5, 12, 12, 456, 106, colors.gray1)-- draw.RoundedBox(10, 12, 12, 456, 20, colors.darkred)     draw.DrawNonParsedText(agenda.Title, "DarkRPHUD1", 15, 55, Color(255, 255, 255, 255), 0)      draw.DrawNonParsedText("- " ..agendaText, "DarkRPHUD1", 15, 80, Color(255, 255, 255, 255), 0) end  -- Drawing HUD Info over players head local localplayer = LocalPlayer()     if localplayer.DRPIsTalking then          local _, chboxY = chat.GetChatBoxPos()         local Rotating = math.sin(CurTime() * 3)         local backwards = 0          if Rotating < 0 then             Rotating = 1 - (1 + Rotating)             backwards = 180 end         surface.SetTexture(VoiceChatTexture)         surface.SetDrawColor(ConVars.Healthforeground)         surface.DrawTexturedRectRotated(Scrw - 100, chboxY, Rotating * 96, 96, backwards)     end          local chbxX, chboxY = chat.GetChatBoxPos()     if GetGlobalBool("DarkRP_LockDown") then          local shouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_LockdownHUD")         if shouldDraw == false then return end          local cin = (math.sin(CurTime()) + 1) / 2          local chatBoxSize = math.floor(Scrh / 4)         draw.DrawNonParsedText(DarkRP.getPhrase("lockdown_started"), "ScoreboardSubtitle", chbxX, chboxY + chatBoxSize, Color(cin * 255, 0, 255 - (cin * 255), 255), TEXT_ALIGN_LEFT)     end      local Arrested = function() end usermessage.Hook("GotArrested", function(msg)local StartArrested = CurTime()     local ArrestedUntil = msg:ReadFloat()     Arrested = function()     local shouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_ArrestedHUD")         if shouldDraw == false then return end if CurTime() - StartArrested <= ArrestedUntil and localplayer:getDarkRPVar("Arrested") then             draw.DrawNonParsedText(DarkRP.getPhrase("youre_arrested", math.ceil((ArrestedUntil - (CurTime() - StartArrested)) * 1 / game.GetTimeScale())), "DarkRPHUD1", Scrw / 2, Scrh - Scrh / 12, colors.white, 1)         else if not              localplayer:getDarkRPVar("Arrested") then             Arrested = function() end              end          end      end end) local AdminTell = function() end usermessage.Hook("AdminTell", function(msg)     timer.Remove("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) --[[---------------------------------------------------------------------------                              Entity HUDPaint things ---------------------------------------------------------------------------]]--  local function DrawPlayerInfo(ply)     local pos = ply:EyePos()     if (ply:GetTable().invis) then return end     pos.z = pos.z + 10     pos = pos:ToScreen()     pos.y = pos.y - 50     if GAMEMODE.Config.showname and not ply:getDarkRPVar("wanted") then         draw.DrawText(ply:Nick(), "DarkRPHUD2", pos.x + 1, pos.y + 1, Color(0, 0, 0, 255), 1)         draw.DrawText(ply:Nick(), "DarkRPHUD2", pos.x, pos.y, team.GetColor(ply:Team()), 1)         draw.DrawText(DarkRP.getPhrase("health", ply:Health()), "DarkRPHUD2", pos.x + 1, pos.y + 21, Color(0, 0, 0, 255), 1)         draw.DrawText(DarkRP.getPhrase("health", ply:Health()), "DarkRPHUD2", pos.x, pos.y + 20, Color(255,255,255,200), 1)     end     if GAMEMODE.Config.showjob then         local teamname = team.GetName(ply:Team())         draw.DrawText(ply:getDarkRPVar("job") or teamname, "DarkRPHUD2", pos.x + 1, pos.y + 41, Color(0, 0, 0, 255), 1)         draw.DrawText(ply:getDarkRPVar("job") or teamname, "DarkRPHUD2", pos.x, pos.y + 40, Color(255, 255, 255, 200), 1)     end     if ply:getDarkRPVar("HasGunlicense") then         surface.SetMaterial(Page)         surface.SetDrawColor(255,255,255,255)         surface.DrawTexturedRect(pos.x-16, pos.y + 60, 32, 32)     end end --[[---------------------------------------------------------------------------                   The Entity display: draw HUD information about entities ---------------------------------------------------------------------------]] local function DrawEntityDisplay()     local shouldDraw, players = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_EntityDisplay")     if shouldDraw == false then return end      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") then ply:drawWantedInfo() end if GAMEMODE.Config.globalshow then             ply:drawPlayerInfo()         -- Draw when you're (almost) looking at himelseif hisPos:DistToSqr(shootPos) < 160000thenlocal 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 break end                 ply:drawPlayerInfo()             end end end              local tr = localplayer:GetEyeTrace()     if IsValid(tr.Entity) and tr.Entity:isKeysOwnable() and tr.Entity:GetPos():DistToSqr(localplayer:GetPos()) < 40000 then         tr.Entity:drawOwnableInfo()     end end --[[--------------------------------------------------------------------------- Drawing the HUD elements such as Health etc. ---------------------------------------------------------------------------]] local function DrawHUD()     local shouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_HUD")     if shouldDraw == false then return end     Scrw, Scrh = ScrW(), ScrH()     RelativeX, RelativeY = 0, Scrh     shouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_LocalPlayerHUD")     shouldDraw = shouldDraw ~= false if shouldDraw then         Base()         GunLicense()         Agenda()         DrawPlayerInfo()         DrawEntityDisplay()     end     DrawPlayerInfo()     Agenda()      DrawVoiceChat()     LockDown()     Arrested()     AdminTell() end --[[---------------------------------------------------------------------------                               Display notifications ---------------------------------------------------------------------------]] local function DisplayNotify(msg)     local txt = msg:ReadString()     GAMEMODE:AddNotify(txt, msg:ReadShort(), msg:ReadLong())     surface.PlaySound("buttons/lightswitch2.wav")     -- Log to client console     MsgC(Color(255, 20, 20, 255), "[DarkRP] ", Color(200, 200, 200, 255), txt, "\n") end usermessage.Hook("_Notify", DisplayNotify) --[[---------------------------------------------------------------------------                               Display death notifications ---------------------------------------------------------------------------]] function DrawDeathNotice(x, y)     if not GAMEMODE.Config.showdeaths then return end     self.Sandbox.DrawDeathNotice(self, x, y) end hook.Add("HUDPaint", "ApolloHUD", Base ) hook.Add("HUDShouldDraw", "HideDefaultDarkRPHud", function(name)     if hideHUDElements[name] then return false end end)   -- Removing Sandbox HUD local hide = {     CHudHealth = true,     CHudBattery = true, }
Sorry, you need to Log In to post a reply to this thread.