Help with "HUD"

Hello i am having a bit issue with the hud where it shows the info of the players, Like “There job”, “There health”, “there name”, and i just replaced the hud info so that players can see the name and etc but it seems to give me a lua error

Sorry about this i am trying to figure it out but it seems a issue for me and i am kinda new with lua so its kinda hard to understand.

This hud is not made by me.


surface.CreateFont( "DarkRPPublicHUD1", {
font = "BudgetLabel",
size = 25,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = true,
outline = true
})

surface.CreateFont( "DarkRPPublicHUD2", {
font = "BudgetLabel",
size = 25,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = true
})

surface.CreateFont( "DarkRPPublicHUD3", {
font = "BudgetLabel",
size = 50,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = true
})


surface.CreateFont( "DarkRPPublicHUD4", {
font = "BudgetLabel",
size = 28,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = true,
outline = true
})

surface.CreateFont( "DarkRPPublicHUD5", {
font = "BudgetLabel",
size = 50,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = true
})

local function darkrphud()

--Maybe if you want you can use the DarkRP HUD values, or they can be useless.
local enabletopmessage = true --Enable(true)or disable(false) the message at the top right of the screen. Disabled by default.

local topmessage = "http://solidroleplay.boards.net" --A message at the top right of the screen, to indicate the server/clan name or the server/clan webpage. Whatever you want.
local topmsgbgcolor = Color(0,0,0,255)--Top message background color
local topmsgcolor = Color(255,255,255,255)--Top message text color

local Hpfrac = math.Clamp(LocalPlayer():Health(),0,100) / 100-- This is the thing to make the HUD go from green to red

local mainbgcolor = Color(0,0,0,150) --The color of the background of the main group of HUD(health, etc)
local ammobgcolor = Color(0,0,0,150) --The color of the background of the ammo group of HUD(ammo clip, etc)

local healthbg = Color(255,255,255,30) --Health bar background color
local healthcolor = Color(255*(4 - Hpfrac),100*Hpfrac,100,255)--The health bar foreground color
local hptextcolor = Color(255*(4 - Hpfrac),255*Hpfrac,255,255)--The health text color
local hpiconcolor = Color(255*(4 - Hpfrac),100*Hpfrac,100,255)--The health icon color

local extrabg = Color(0,0,0,150) --Extra bar background color
local hpextracolor = Color(0,180,180,255) -- the health bar color when it's over 100HP
local hptxtextracolor = Color(0,255,255,255) -- the health text color when it's over 100HP

local extravalue = LocalPlayer():Armor()--The extra bar value, armor bar by default
local extracolor = Color(100,100,100,255)--The extra bar color, grey by default
local extratextcolor = Color(200,200,200,255)--The extra value text color, light grey by default

local moneycolor = Color(0,255,0,255)--The color of the money indicator
local salarycolor = Color(0,255,0,255)--The color of the salary indicator

local jobcolor = Color(255,255,255,255)--The color of the job indicator
local jobbg = team.GetColor(LocalPlayer():Team())--The color of the job indicator background

local namecolor = Color(255,255,255,255)--The color of the name indicator

local ammocolor = Color(255,255,255,255)
if LocalPlayer():GetActiveWeapon().Primary != nil then
    if (LocalPlayer():GetActiveWeapon():Clip1()*100)/LocalPlayer():GetActiveWeapon().Primary.ClipSize > 25 then
        ammocolor = Color(0,133,255,255)--Ammo clip text color
    else
        ammocolor = Color(255,0,0,255)--Ammo clip text color when is less that 25% of clip capacity
    end
end

local ammocolor2 = Color(0,133,255,255)--Extra ammo text color

local hptexture = Material("icon16/heart.png")--Health icon
local extratexture = Material("icon16/shield.png")--Extra bar icon, armor bar by default
local moneytexture = Material("icon16/money.png")--Money icon
local salarytexture = Material("icon16/money_add.png")--Salary icon
local jobtexture = Material("icon16/user_suit.png")--Job icon
local nametexture = Material("icon16/user.png")--Name icon
local licensetex = Material("icon16/page.png")

local mainposx = 10 --The X position of the main group of HUD (health, etc)
local mainposy = ScrH() - 60 --The Y position of the main group of HUD (health, etc)

local ammoposx = ScrW() - 210 --The X position of the ammo group of HUD (ammo clip, etc)
local ammoposy = ScrH() - 70 --The Y position of the ammo group of HUD (ammo clip, etc)

/*-------------------------------------------------------------------------
    
    Here begins the HUD function, just edit if you're advanced!
    
--------------------------------------------------------------------------*/

local client = LocalPlayer()
LocalPlayer().DarkRPVars = LocalPlayer().DarkRPVars or {}
local rpname = (client.DarkRPVars.rpname or "")
local money = (client.DarkRPVars.money or 0)
local salary = (client.DarkRPVars.salary or 0)
local job = (client.DarkRPVars.job or "")

	if enabletopmessage == true then
        --Top message
        surface.SetFont("DarkRPPublicHUD2")
        local tmsgspace = surface.GetTextSize(topmessage)
        draw.RoundedBox(8, ScrW() - tmsgspace - 13, 5, tmsgspace + 8, 25, topmsgbgcolor)
        draw.SimpleText(topmessage,"DarkRPPublicHUD2", ScrW() - tmsgspace - 10, 5, topmsgcolor)
	end

    --Main background
    if extravalue > 0 then
        draw.RoundedBox(8, mainposx, mainposy, 240, 51, mainbgcolor)
    else
        draw.RoundedBox(8, mainposx, mainposy, 240, 30, mainbgcolor)
    end
        --Health bar
       draw.RoundedBox(6, mainposx + 30, mainposy + 5, 200, 20, healthbg)--health bar background
    
        if client:Health() > 100 then
            draw.RoundedBox(6, mainposx + 30, mainposy + 5, 200, 20, hpextracolor)--health bar color
            draw.RoundedBox(4, mainposx + 30, mainposy + 5, 200, 8, Color(255,255,255,40))--Health bar bright
            draw.SimpleText(client:Health(), "DarkRPPublicHUD4", mainposx + 127, mainposy + 3, hptxtextracolor, 1, 0)
        elseif client:Health() > 0 then
            draw.RoundedBox(6, mainposx + 30, mainposy + 5, (client:Health()*200)/100, 20, healthcolor)--health bar color
            draw.RoundedBox(4, mainposx + 30, mainposy + 5, (client:Health()*200)/100, 8, Color(255,255,255,40))--Health bar bright
            draw.SimpleText(client:Health(), "DarkRPPublicHUD4", mainposx + 127, mainposy + 1, hptextcolor, 1, 0)
        else
            draw.SimpleText("0", "DarkRPPublicHUD4", mainposx + 127, mainposy + 3, hptextcolor, 1, 0)
        end
        --Health icon
        surface.SetMaterial(hptexture)
    
        if client:Health() > 100 then
            surface.SetDrawColor(hptxtextracolor)
        else
            surface.SetDrawColor(hpiconcolor)
        end
    
        surface.DrawTexturedRect(mainposx+7,mainposy+7,18,18)
        
        --Extra bar
        if extravalue > 0 then
            draw.RoundedBox(8, mainposx + 30, mainposy + 28, 200, 18, healthbg)--extra bar bar background
    
            if extravalue > 100 then
                draw.RoundedBox(6, mainposx + 30, mainposy + 28, 200, 18, extracolor)--extra bar foreground
                draw.RoundedBox(4, mainposx + 30, mainposy + 28, 200, 8, Color(255,255,255,40))--extra bar bright
                draw.SimpleText(extravalue, "DarkRPPublicHUD1", mainposx + 127, mainposy + 26, extratextcolor, 1, 0)--extra text
            elseif extravalue > 0 then
                draw.RoundedBox(6, mainposx + 30, mainposy + 28, (extravalue*200)/100, 18, extracolor)--extra bar foreground
                draw.RoundedBox(4, mainposx + 30, mainposy + 28, (extravalue*200)/100, 8, Color(255,255,255,40))--extra bar bright
                draw.SimpleText(extravalue, "DarkRPPublicHUD1", mainposx + 127, mainposy + 26, extratextcolor, 1, 0)--extra value text
            end
            --Extra icon
            surface.SetMaterial(extratexture)
            surface.SetDrawColor(255,255,255,255)
            surface.DrawTexturedRect(mainposx+8,mainposy+29,16,16)
        end
    --Money 'n stuff
        --Money
        surface.SetFont("DarkRPPublicHUD2")
        draw.RoundedBox(8,mainposx, mainposy - 28, surface.GetTextSize("$"..money)+34, 26, mainbgcolor)
            
            draw.SimpleText("$"..money, "DarkRPPublicHUD2", mainposx + 26, mainposy - 26, moneycolor)
            surface.SetMaterial(moneytexture)
            surface.SetDrawColor(255,255,255,255)
            surface.DrawTexturedRect(mainposx + 6,mainposy - 23, 16, 16)
            
            --Salary
			surface.SetFont("DarkRPPublicHUD2")
            draw.RoundedBox(8,mainposx + surface.GetTextSize(money) + 46, mainposy - 28, surface.GetTextSize(salary)+50, 26, mainbgcolor)
            
                draw.SimpleText("$"..salary, "DarkRPPublicHUD2", mainposx + surface.GetTextSize(money) + 75, mainposy - 26, salarycolor)
                surface.SetMaterial(salarytexture)
                surface.SetDrawColor(255,255,255,255)
                surface.DrawTexturedRect(mainposx + surface.GetTextSize(money) + 54,mainposy - 24, 16, 16)
        --Job background
        surface.SetFont("DarkRPPublicHUD2")
        draw.RoundedBox(8,mainposx, mainposy - 56, surface.GetTextSize(job)+40, 26, jobbg)
        
            draw.SimpleText(job, "DarkRPPublicHUD2", mainposx + 30, mainposy - 55, jobcolor)
            surface.SetMaterial(jobtexture)
            surface.SetDrawColor(255,255,255,255)
            surface.DrawTexturedRect(mainposx + 6,mainposy - 52, 16, 16)
			
			--Gun license
			if LocalPlayer().DarkRPVars.HasGunlicense == true then
				draw.RoundedBox(8,surface.GetTextSize(job) + mainposx + 50, mainposy - 56, 30, 30, mainbgcolor)
				surface.SetMaterial(licensetex)
				surface.SetDrawColor(255,255,255,255)
				surface.DrawTexturedRect(surface.GetTextSize(job) + mainposx + 58,mainposy - 50, 16, 16)
			end
        
        --Name background
        draw.RoundedBox(8,mainposx, mainposy - 84, surface.GetTextSize(rpname)+40, 26, mainbgcolor)
        
            draw.SimpleText(rpname, "DarkRPPublicHUD2", mainposx + 30, mainposy - 82, namecolor)
            surface.SetMaterial(nametexture)
            surface.SetDrawColor(255,255,255,255)
            surface.DrawTexturedRect(mainposx + 6,mainposy - 80, 16, 16)
			
/*---------------------------------------------------------------------------
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.DarkRPVars.wanted then
		draw.DrawText(ply:Nick(), "DarkRPPublicHUD5", pos.x + 1, pos.y + 1, Color(0, 0, 0, 255), 1)
		draw.DrawText(ply:Nick(), "DarkRPPublicHUD5", pos.x, pos.y, team.GetColor(ply:Team()), 1)
		draw.DrawText(LANGUAGE.health ..ply:Health(), "DarkRPPublicHUD5", pos.x + 1, pos.y + 21, Color(0, 0, 0, 255), 1)
		draw.DrawText(LANGUAGE.health..ply:Health(), "DarkRPPublicHUD5", 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.DarkRPVars.job or teamname, "DarkRPPublicHUD5", pos.x + 1, pos.y + 41, Color(0, 0, 0, 255), 1)
		draw.DrawText(ply.DarkRPVars.job or teamname, "DarkRPPublicHUD5", pos.x, pos.y + 40, Color(255, 255, 255, 200), 1)
	end

	if ply.DarkRPVars.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:RPIsInSight({localplayer, ply}) then return end

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

	if GAMEMODE.Config.showname then
		draw.DrawText(ply:Nick(), "DarkRPPublicHUD5", pos.x + 1, pos.y + 1, Color(0, 0, 0, 255), 1)
		draw.DrawText(ply:Nick(), "DarkRPPublicHUD5", pos.x, pos.y, team.GetColor(ply:Team()), 1)
	end

	local wantedText = string.format("%s
Reason: %s", LANGUAGE.wanted, tostring(ply.DarkRPVars["wantedReason"]))   

	draw.DrawText(wantedText, "DarkRPPublicHUD5", pos.x, pos.y - 40, Color(255, 255, 255, 200), 1)
	draw.DrawText(wantedText, "DarkRPPublicHUD5", pos.x + 1, pos.y - 41, Color(255, 0, 0, 255), 1)
end

    --Weapons and stuff
    if client:GetActiveWeapon() != NULL then
        if client:GetActiveWeapon():Clip1() != -1 then
            if client:GetActiveWeapon():GetPrintName() != "#HL2_GravityGun" then
                draw.RoundedBox(8, ammoposx, ammoposy, 200, 50, ammobgcolor)
        
              --Clip
              draw.SimpleText(client:GetActiveWeapon():Clip1(),"DarkRPPublicHUD3",ammoposx + 80, ammoposy + 3, ammocolor,2,0)
        
                --Extra
                draw.SimpleText(client:GetAmmoCount(client:GetActiveWeapon():GetPrimaryAmmoType()),"DarkRPPublicHUD1",ammoposx + 90, ammoposy, ammocolor2,0,0)
                --Ammo bar
                if client:GetActiveWeapon().Primary != nil then
                    draw.RoundedBox(6, ammoposx + 85, ammoposy + 25, 105, 15, ammobgcolor)
                    if client:GetActiveWeapon():Clip1() > 0 then
                        draw.RoundedBox(6, ammoposx + 85, ammoposy + 25, (client:GetActiveWeapon():Clip1()*105)/client:GetActiveWeapon().Primary.ClipSize, 15, ammocolor)
                    end
                end
            end
        else
            if client:GetAmmoCount(client:GetActiveWeapon():GetPrimaryAmmoType()) != 0 then
                draw.RoundedBox(8, ammoposx, ammoposy, 60, 50, ammobgcolor)
                draw.SimpleText(client:GetAmmoCount(client:GetActiveWeapon():GetPrimaryAmmoType()),"DarkRPPublicHUD3",ammoposx + 50, ammoposy, ammocolor,2,0)
            end
        end
    end
end
hook.Add("HUDPaint", "darkrphud", darkrphud)

local tohide = { -- This is a table where the keys are the HUD items to hide
["CHudHealth"] = true,
["CHudBattery"] = true,
["CHudAmmo"] = true,
["CHudSecondaryAmmo"] = true
}
local function HUDShouldDraw(name) -- This is a local function because all functions should be local unless another file needs to run it
if (tohide[name]) then     -- If the HUD name is a key in the table
return false;      -- Return false.
end
end
hook.Add("HUDShouldDraw", "darkrphudShouldDraw", HUDShouldDraw)

Can you atleast post the error ?

Can you show us the error/s.

This is the error

Disconnect: “Too many Lua Errors! Sorry!”.
Disconnect: “Too many Lua Errors! Sorry!”.

this was on my test server, it didn’t show where but when i add this code in it gave me a lua error

this is the code i added:

Post the yellow/blue lines from console.

Ok nvm i fixed the error, now some reason when i go up to a person their name doesn’t show or job.

for example: http://prntscr.com/1d911v

is there a way i can make it where i can show thier name again?