Custom Hud not showing

So I made a HUD off of the darkrp version and tried putting it back into the game, this is what i got on my test server on lan

http://images.akamai.steamusercontent.com/ugc/394421705864275482/4A2F42A2753701F593DD4C3F35564AB36019F25B/

On my Dedicated server it doesn’t show. I took out a hud that was in the darkrpmodifacation modules folder and put mine in. I did the same with my lan server. Heres the code for the HUD

[LUA]local function Base()

draw.RoundedBox(6, ScrW() - 1920, ScrH () - 40, 1920, 40, Color(73, 73, 73, 235)) -- Grey Base

draw.RoundedBox(6, ScrW() - 1940, ScrH () - 5, 1940, 5, Color(0, 16, 87, 255))-- Blue underline
	
draw.RoundedBox(6, ScrW() - 1530 + 2, ScrH () - 41 + 2, 440-30, 30, Color(0, 0, 0, 255)) -- Health Bar background

local DrawHealth = LocalPlayer():Health() or 0
local EchoHealth = LocalPlayer():Health() or 0

if DrawHealth > 100 then DrawHealth = 100 end
if DrawHealth < 0 then DrawHealth = 0 end

if DrawHealth != 0 then
    draw.RoundedBox(6, ScrW() - 1527 + 2, ScrH () - 39 + 2, 403 * DrawHealth / 100, 25, Color(255,0,0,255))
end

local DrawHealth = LocalPlayer():Health() or 0
local EchoHealth = LocalPlayer():Health() or 0

if DrawHealth > 200 then DrawHealth = 200 end
if DrawHealth < 100 then DrawHealth = 0 end

if DrawHealth != 100 then
        draw.RoundedBox(6, ScrW() - 1522 + 2, ScrH () - 37 + 2, 393 * DrawHealth / 200, 20, Color(255,221,0,255))
	end
	
local DrawHealth = LocalPlayer():Health() or 0
local EchoHealth = LocalPlayer():Health() or 0

if DrawHealth > 300 then DrawHealth = 300 end
if DrawHealth < 200 then DrawHealth = 0 end

    if DrawHealth != 200 then
            draw.RoundedBox(6, ScrW() - 1517 + 2, ScrH () - 35 + 2, 383 * DrawHealth / 300, 15, Color(0,225,0,255))
    end
	
	local DrawHealth = LocalPlayer():Health() or 0
    local EchoHealth = LocalPlayer():Health() or 0

    if DrawHealth > 400 then DrawHealth = 400 end
    if DrawHealth < 300 then DrawHealth = 0 end

    if DrawHealth != 300 then
            draw.RoundedBox(6, ScrW() - 1512 + 2, ScrH () - 33 + 2, 373 * DrawHealth / 400, 10, Color(255,0,255,255))
    end
	
	local DrawHealth = LocalPlayer():Health() or 0
    local EchoHealth = LocalPlayer():Health() or 0

    if DrawHealth > 500 then DrawHealth = 500 end
    if DrawHealth < 400 then DrawHealth = 0 end

    if DrawHealth != 400 then
            draw.RoundedBox(6, ScrW() - 1507 + 2, ScrH () - 31 + 2, 363 * DrawHealth / 500, 6, Color(0,200,255,255))
    end
	
    draw.DrawText( "Health: "..EchoHealth, "CloseCaption_Normal", ScrW() - 400 - 980, ScrH () - 36, Color(50, 50, 50, 255))
	
	draw.RoundedBox(6, ScrW() - 1070, ScrH () - 39, 70, 25, Color(0, 16, 87, 200))
	
	draw.DrawText( "$"..LocalPlayer():getDarkRPVar( "salary" ), "CloseCaption_Normal", ScrW() - 1070, ScrH() - 42, Color(255, 255, 255, 255))
	
	draw.RoundedBox(6, ScrW() - 950, ScrH () - 39, 150, 25, Color(0, 16, 87, 200))
	
	draw.DrawText( "$"..LocalPlayer():getDarkRPVar( "money" ), "CloseCaption_Normal", ScrW() - 950, ScrH () - 42, Color(255, 255, 255, 255))
	
	draw.RoundedBox(6, ScrW() - 300 - 1615, ScrH () - 39, 300, 25, Color(0, 16, 87, 200))
	
	draw.DrawText( LocalPlayer():Nick(), "CloseCaption_Normal", ScrW() - 400 - 1480, ScrH () - 42, Color(255, 255, 255, 255))
	
	draw.DrawText( "Salary", "BudgetLabel", ScrW() - 1055, ScrH () - 16, Color(60, 130, 255, 255))
	
	draw.DrawText( "Cash / Liquid / Doe", "BudgetLabel", ScrW() - 945, ScrH () - 16, Color(60, 130, 255, 255))
	
	draw.DrawText( "N a m e", "BudgetLabel", ScrW() - 200 - 1580, ScrH () - 16, Color(60, 130, 255, 255))
	
	draw.RoundedBox(6, ScrW() - 750, ScrH () - 39, 150, 25, Color(0, 16, 87, 200))
	
	draw.DrawText( LocalPlayer():getDarkRPVar( "job" ) , "CloseCaption_Normal", ScrW() - 750, ScrH () - 42, Color(255, 255, 255, 255))
	
	draw.DrawText( "J O B", "BudgetLabel", ScrW() - 696, ScrH () - 16, Color(60, 130, 255, 255))
	
	draw.RoundedBox(6, ScrW() - 200, ScrH () - 39, 190, 31, Color(0, 16, 87, 200))
	
	draw.DrawText( "BOOMs DarkRP", "DermaLarge", ScrW() - 200, ScrH () - 39, Color(255, 255, 255, 255))
	
	draw.RoundedBox(6, ScrW() - 550, ScrH () - 39, 290, 31, Color(0, 16, 87, 200))
	
	draw.DrawText( LocalPlayer():SteamID(), "DermaLarge", ScrW() - 550, ScrH () - 39, Color(255, 255, 255, 255))
	
	draw.DrawText( "Armor", "Trebuchet24", ScrW() - 1604, ScrH () - 37, Color(255, 255, 255, 255))
	
	draw.RoundedBox(6, ScrW() - 1610 + 2, ScrH () - 39, 60, 31, Color(0, 16, 87, 200))

	local DrawPlayerArmor = LocalPlayer():Armor() or 0
	local EchoPlayerArmor = LocalPlayer():Armor() or 0

	if DrawPlayerArmor > 100 then DrawPlayerArmor = 100 end
	if DrawPlayerArmor < 0 then DrawPlayerArmor = 0 end

	if DrawPlayerArmor != 0 then
			draw.RoundedBox(6, ScrW() - 1610 + 2, ScrH () - 39, 363 * DrawPlayerArmor / 500, 31, Color(0,0,255,255))
    end

end

/---------------------------------------------------------------------------
HUD ConVars
---------------------------------------------------------------------------
/
local ConVars = {}
local HUDWidth
local HUDHeight

local Color = Color
local cvars = cvars
local DarkRP = DarkRP
local CurTime = CurTime
local draw = draw
local GetConVar = GetConVar
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

CreateClientConVar(“weaponhud”, 0, true, false)

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, 155)
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
/---------------------------------------------------------------------------
HUD Seperate Elements
---------------------------------------------------------------------------
/

local Page = Material(“icon16/page_white_text.png”)
local function GunLicense()
if localplayer:getDarkRPVar(“HasGunlicense”) then
surface.SetMaterial(Page)
surface.SetDrawColor(255, 255, 255, 255)
surface.DrawTexturedRect(RelativeX + HUDWidth, ScrH() - 34, 32, 32)
end
end

local function Agenda()
local ply = LocalPlayer()

    local agenda = ply:getAgendaTable()
    if not agenda then return end

    draw.RoundedBox(10, 10, 10, 460, 110, colors.gray1)
    draw.RoundedBox(10, 12, 12, 456, 106, colors.gray2)
    draw.RoundedBox(10, 12, 12, 456, 20, colors.darkred)

    draw.DrawNonParsedText(agenda.Title, "DarkRPHUD1", 30, 12, colors.red, 0)

    local text = ply:getDarkRPVar("agenda") or ""

    text = text:gsub("//", "

“):gsub(”
", "
")
text = DarkRP.textWrap(text, “DarkRPHUD1”, 440)
draw.DrawNonParsedText(text, “DarkRPHUD1”, 30, 35, colors.white, 0)
end

local VoiceChatTexture = surface.GetTextureID(“voice/icntlk_pl”)
local function DrawVoiceChat()
if localplayer.DRPIsTalking then
local chbxX, 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

end

CreateConVar(“DarkRP_LockDown”, 0, {FCVAR_REPLICATED, FCVAR_SERVER_CAN_EXECUTE})
local function LockDown()
local chbxX, chboxY = chat.GetChatBoxPos()
if util.tobool(GetConVarNumber(“DarkRP_LockDown”)) then
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
end

local Arrested = function() end

usermessage.Hook(“GotArrested”, function(msg)
local StartArrested = CurTime()
local ArrestedUntil = msg:ReadFloat()

    Arrested = function()
            if CurTime() - StartArrested <= ArrestedUntil and localplayer:getDarkRPVar("Arrested") then
            draw.DrawNonParsedText(DarkRP.getPhrase("youre_arrested", math.ceil(ArrestedUntil - (CurTime() - StartArrested))), "DarkRPHUD1", ScrW()/2, ScrH() - ScrH()/12, colors.white, 1)
            elseif not localplayer:getDarkRPVar("Arrested") then
                    Arrested = function() end
            end
    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, 100, colors.darkblack)
            draw.DrawNonParsedText(DarkRP.getPhrase("listen_up"), "GModToolName", ScrW() / 2 + 10, 10, colors.white, 1)
            draw.DrawNonParsedText(Message, "ChatFont", ScrW() / 2 + 10, 80, 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()

    pos.z = pos.z + 10 -- The position we want is a bit above the position of the eyes
    pos = pos:ToScreen()
    pos.y = pos.y - 50 -- Move the text up a few pixels to compensate for the height of the text

    if GAMEMODE.Config.showname and not ply:getDarkRPVar("wanted") then
            draw.DrawNonParsedText(ply:Nick(), "DarkRPHUD2", pos.x + 1, pos.y + 1, colors.black, 1)
            draw.DrawNonParsedText(ply:Nick(), "DarkRPHUD2", pos.x, pos.y, team.GetColor(ply:Team()), 1)
    end

    if GAMEMODE.Config.showhealth and not ply:getDarkRPVar("wanted") then
            draw.DrawNonParsedText(DarkRP.getPhrase("health", ply:Health()), "DarkRPHUD2", pos.x + 1, pos.y + 21, colors.black, 1)
            draw.DrawNonParsedText(DarkRP.getPhrase("health", ply:Health()), "DarkRPHUD2", pos.x, pos.y + 20, colors.white1, 1)
    end

    if GAMEMODE.Config.showjob then
            local teamname = team.GetName(ply:Team())
            draw.DrawNonParsedText(ply:getDarkRPVar("job") or teamname, "DarkRPHUD2", pos.x + 1, pos.y + 41, colors.black, 1)
            draw.DrawNonParsedText(ply:getDarkRPVar("job") or teamname, "DarkRPHUD2", pos.x, pos.y + 40, colors.white1, 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

local function DrawWantedInfo(ply)
if not ply:Alive() then return end

    local pos = ply:EyePos()
    if not pos:isInSight({localplayer, ply}) then return end

    pos.z = pos.z + 14
    pos = pos:ToScreen()

    if GAMEMODE.Config.showname then
            draw.DrawNonParsedText(ply:Nick(), "DarkRPHUD2", pos.x + 1, pos.y + 1, colors.black, 1)
            draw.DrawNonParsedText(ply:Nick(), "DarkRPHUD2", pos.x, pos.y, team.GetColor(ply:Team()), 1)
    end

    local wantedText = DarkRP.getPhrase("wanted", tostring(ply:getDarkRPVar("wantedReason")))

    draw.DrawNonParsedText(wantedText, "DarkRPHUD2", pos.x, pos.y - 40, colors.white1, 1)
    draw.DrawNonParsedText(wantedText, "DarkRPHUD2", pos.x + 1, pos.y - 41, colors.red, 1)

end

/---------------------------------------------------------------------------
The Entity display: draw HUD information about entities
---------------------------------------------------------------------------
/
local function DrawEntityDisplay()

    local shootPos = localplayer:GetShootPos()
    local aimVec = localplayer:GetAimVector()

    for k, ply in pairs(players or player.GetAll()) do
            if not ply:Alive() or ply == localplayer then continue end
            local hisPos = ply:GetShootPos()
            if ply:getDarkRPVar("wanted") then DrawWantedInfo(ply) end

            if GAMEMODE.Config.globalshow then
                    DrawPlayerInfo(ply)
            -- Draw when you're (almost) looking at him
            elseif not GAMEMODE.Config.globalshow and hisPos:DistToSqr(shootPos) < 160000 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
                            DrawPlayerInfo(ply)
                    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

/---------------------------------------------------------------------------
Drawing death notices
---------------------------------------------------------------------------
/
function GAMEMODE:DrawDeathNotice(x, y)
if not GAMEMODE.Config.showdeaths then return end
self.BaseClass:DrawDeathNotice(x, y)
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
    print(txt)

end
usermessage.Hook("_Notify", DisplayNotify)

/---------------------------------------------------------------------------
Remove some elements from the HUD in favour of the DarkRP HUD
---------------------------------------------------------------------------
/
function GAMEMODE:HUDShouldDraw(name)
if name == “CHudHealth” or
name == “CHudBattery” or
name == “CHudSuitPower” or
(HelpToggled and name == “CHudChat”) then
return false
else
return true
end
end

/---------------------------------------------------------------------------
Disable players’ names popping up when looking at them
---------------------------------------------------------------------------
/
function GAMEMODE:HUDDrawTargetID()
return false
end

/---------------------------------------------------------------------------
Actual HUDPaint hook
---------------------------------------------------------------------------
/
function DrawHUD()
localplayer = localplayer and IsValid(localplayer) and localplayer or LocalPlayer()
if not IsValid(localplayer) then return end

    -- Custom
    Base()
	
    -- Default
    GunLicense()
    Agenda()
    DrawVoiceChat()
    LockDown()
    Arrested()
    AdminTell()
    DrawEntityDisplay()

end
hook.Add(“HUDPaint”, “DrawHUD”, DrawHUD)[/LUA]

Also if someone may teach me or direct me to a website that teaches lua, thank you because i enjoyed making this HUD. Don’t send me to darkrp wiki. Don’t like the way things are setup there.[table=“width: 500”]

[noparse][lua]code[/lua][/noparse] tags please

[editline]16th October 2015[/editline]

any errors in console?

No, I did have one where it was saying that it was saying line 63(salary text) was attempting to concentrate a nil value. I deleted salary and wrote it again and it was fine

AddCSLuaFile() ?

ill try it

[editline]19th October 2015[/editline]

I might be putting it in the wrong place but I tries it alone, local, and local function and in a shared.lua file.

it should all be in a client lua (your file anyways) if it is in the modules folder of darkrpmodification then it should automatically load and be added to the clientside lua file list. (AddCSLuaFile())

close it in

if CLIENT then

all your code

end

it might be erroring server side?

This is what im thinking your saying
AddCSLuaFile(
if CLIENT then
“code”
end)

or

AddCSLuaFile("cl_chud.lua)
if CLIENT then
“code”
end

or

AddCSLuaFile()
if CLIENT then
“code”
end

I understand what they do but just where to put them, since its my first time its kinda confusing
thank you for your help though. I tried all 3 of those and nothing shows on my dedicated.

AddCSLuaFile()
if CLIENT then
“code”
end

[editline]21st October 2015[/editline]

wait if the file is cl_hud.lua you shouldnt have to wrap in if client… honestly man i have no idea darkrp automatically addcsluafile() all cl_ files as far as i know

[editline]21st October 2015[/editline]

i also JUST realized this was in the wrong section :stuck_out_tongue: