Lua Error

Just a quick little thread here, I’m getting this error ever since I changed my Hud, please help!

[ERROR] addons/darkrpmodification-master/lua/darkrp_modules/hudreplacement/cl_hudreplacement.lua:1: attempt to index global ‘HUDSettings’ (a nil value)

  1. unknown - addons/darkrpmodification-master/lua/darkrp_modules/hudreplacement/cl_hudreplacement.lua:1
  2. include - [C]:-1
    3. loadModules - gamemodes/darkrp/gamemode/libraries/modificationloader.lua:79
    4. fn - gamemodes/darkrp/gamemode/libraries/modificationloader.lua:119
    5. unknown - addons/ulib/lua/ulib/shared/hook.lua:183

R

I truly apologize if this is the wrong section I’m new to these forums!

Post the code from your cl_hudreplacement.lua

[REMOVED]

tags plz

Sorry?

Put your code in code tags [ lua][/lua]

-snip-


local hudTheme = HUDTheme[HUDSettings.theme]
vdrawav = true

surface.CreateFont( "NAMEFONT", {
 font = hudTheme.font.nickfont,
 size = hudTheme.font.nicksize,
 weight = hudTheme.font.nickweight,
 antialias = true,
 outline = hudTheme.font.nickoutline
} )

surface.CreateFont( "SALARY", {
 font = hudTheme.font.salaryfont,
 size = hudTheme.font.salarysize,
 weight = hudTheme.font.salaryweight,
 antialias = true,
 outline = hudTheme.font.salaryoutline
} )

surface.CreateFont( "WALLETFONT", {
 font = hudTheme.font.walletfont,
 size = hudTheme.font.walletsize,
 weight = hudTheme.font.walletweight,
 antialias = true, 
 outline = hudTheme.font.walletoutline
 } )

surface.CreateFont( "JOBFONT", {
 font = hudTheme.font.jobfont,
 size = hudTheme.font.jobsize,
 weight = hudTheme.font.jobweight,
 antialias = true, 
 outline = hudTheme.font.joboutline
} )
 
surface.CreateFont( "HPFONT", {
 font = hudTheme.font.hpfont,
 size = hudTheme.font.hpsize,
 weight = hudTheme.font.hpweight,
 antialias = true,
 outline = hudTheme.font.hpoutline
} )

surface.CreateFont( "ARFONT", {
 font = hudTheme.font.arfont,
 size = hudTheme.font.arsize,
 weight = hudTheme.font.arweight,
 antialias = true,
 outline = hudTheme.font.aroutline
} )

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
	["DarkRP_LocalPlayerHUD"] = 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)

HM = {}
HM.UsingHungerMod = false

local function DrawPNG(pngtex, x, y, w, h, color)
	surface.SetMaterial( pngtex )
	surface.SetDrawColor(color)
	surface.DrawTexturedRect( x, y, w, h )
end

local function DrawPlayerAvatar( p, x ,y )
	av = vgui.Create("AvatarImage")
	av:SetPos(x,y)
	av:SetSize(64, 64)
	av:SetPlayer( p, 64 )
	return av
end

local function formatNumber(n)
	if not n then return "" end
	if n >= 1e14 then return tostring(n) end
    n = tostring(n)
    local sep = sep or ","
    local dp = string.find(n, "%.") or #n+1
	for i=dp-4, 1, -3 do
		n = n:sub(1, i) .. sep .. n:sub(i+1)
    end
    return n
end

function DoAvatar()
	if IsValid(HUDAVATAR) then
		if HUDAVATAR:IsValid() then
			HUDAVATAR:Remove()
		end
	end
	if hudTheme.avatar == true then
		HUDAVATAR = DrawPlayerAvatar( LocalPlayer(), hudTheme.mainx + hudTheme.avatarx ,hudTheme.mainy + hudTheme.avatary )
	end
	vdrawav = false
end

local function hudPaint()
   localplayer = localplayer and IsValid(localplayer) and localplayer or LocalPlayer()
   if not IsValid(localplayer) then return end
   if vdrawav == true then DoAvatar() end

   local shouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_HUD")
   if shouldDraw == false then return end

   Scrw, Scrh = ScrW(), ScrH()
   RelativeX, RelativeY = 0, Scrh - 10

   local Salary =    "" .. GAMEMODE.Config.currency .. (localplayer:getDarkRPVar("salary") or 0)
   local Job = localplayer:getDarkRPVar("job") or ""
   local Wallet = "" .. GAMEMODE.Config.currency .. (formatNumber(localplayer:getDarkRPVar("money") or 0) or 0)   
   local HW, HH = hudTheme.mainw, hudTheme.mainh
   local HX, HY = hudTheme.mainx, hudTheme.mainy
   
   -- Main
	
	draw.RoundedBox( 0, HX, HY, HW, HH, hudTheme.maincolor )
	if hudTheme.pattern == true then
		DrawPNG(Material("hud/"..hudTheme.patternpng), HX, HY, HW, HH, Color(255,255,255,hudTheme.patternalpha))
	end
	if hudTheme.gradient == true then
		DrawPNG(Material("hud/"..hudTheme.gradpng), HX, HY, HW, HH, Color(255,255,255,hudTheme.gradalpha))
	end
	draw.RoundedBox( 0, HX, HY - 1, HW, 1, Color(20,20,20,240) )
	draw.RoundedBox( 0, HX, HY + HH, HW, 1, Color(20,20,20,240) )
	draw.RoundedBox( 0, HX + HW, HY, 1, HH, Color(20,20,20,240) )
	draw.RoundedBox( 0, HX - 1, HY, 1, HH, Color(20,20,20,240) )
	if hudTheme.avatar == true then
		draw.RoundedBox( 0, hudTheme.mainx + hudTheme.avatarx - 1, hudTheme.mainy + hudTheme.avatary - 1, 66, 66, Color(20,20,20,240) )
	end
		
   -- Name
   draw.SimpleText(LocalPlayer():Nick() ,"NAMEFONT", HX + hudTheme.nickx, HY + hudTheme.nicky, hudTheme.nickcol, TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT)

   -- Job
   draw.SimpleText(Job, "JOBFONT", HX + hudTheme.jobx, HY + hudTheme.joby, hudTheme.jobcol, TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT)

   -- Wallet
   surface.SetFont("WALLETFONT")
   local walletwidth = surface.GetTextSize( "Wallet " .. Wallet )
   draw.SimpleText("Wallet " .. Wallet, "WALLETFONT", (HX + HW) - walletwidth - hudTheme.walletx ,HY + hudTheme.wallety, hudTheme.walletcol, TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT)

   -- Salary
   surface.SetFont("SALARY")
   local salarywidth = surface.GetTextSize( Salary )
   draw.SimpleText(Salary, "SALARY", (HX + HW) - salarywidth - hudTheme.salaryx , HY + hudTheme.salaryy, hudTheme.salarycol, TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT) 
   
   -- Health
    local Health = LocalPlayer():Health()
    local DrawHealth = math.Min(Health / GAMEMODE.Config.startinghealth, 1)
	local hpsettings = hudTheme.healthbar
	local hpcorn = hpsettings.corners
	if hpsettings.center == true then
		draw.RoundedBoxEx(hpsettings.bordersize, HX + hpsettings.x, HY + hpsettings.y, HW - (hpsettings.x * 2), hpsettings.h, hpsettings.bg , hpcorn[1], hpcorn[2], hpcorn[3], hpcorn[4])
	else
		draw.RoundedBoxEx(hpsettings.bordersize, HX + hpsettings.x, HY + hpsettings.y, hpsettings.w, hpsettings.h, hpsettings.bg , hpcorn[1], hpcorn[2], hpcorn[3], hpcorn[4])	
	end
    if Health > 0 then
		if hpsettings.center == true then
			draw.RoundedBoxEx(hpsettings.bordersize, HX + hpsettings.x, HY + hpsettings.y, (HW - (hpsettings.x * 2)) * DrawHealth, hpsettings.h, hpsettings.fg, hpcorn[1], hpcorn[2], hpcorn[3], hpcorn[4])
		else
			draw.RoundedBoxEx(hpsettings.bordersize, HX + hpsettings.x, HY + hpsettings.y, hpsettings.w * DrawHealth, hpsettings.h, hpsettings.fg, hpcorn[1], hpcorn[2], hpcorn[3], hpcorn[4])
		end
	end
	if hpsettings.text == true then
		surface.SetFont("HPFONT")
		local htxtsize = surface.GetTextSize( "Health: "..Health )
		if hpsettings.textcenter == true then
			draw.DrawText("Health: "..Health, "HPFONT", HX + (HW / 2) - (htxtsize / 2), HY + hpsettings.texty, Color(235,235,235,255), TEXT_ALIGN_LEFT)
		else
			draw.DrawText("Health: "..Health, "HPFONT", HX + hpsettings.textx, HY + hpsettings.texty, Color(235,235,235,255), TEXT_ALIGN_LEFT)
		end
	end
        -- Armor
    local Armor = LocalPlayer():Armor()
	local arsettings = hudTheme.armorbar
	local arcorn = arsettings.corners
	if arsettings.center == true then
		draw.RoundedBoxEx(arsettings.bordersize, HX + arsettings.x, HY + arsettings.y, HW - (arsettings.x * 2), arsettings.h, arsettings.bg, arcorn[1], arcorn[2], arcorn[3], arcorn[4] )
    else
		draw.RoundedBoxEx(arsettings.bordersize, HX + arsettings.x, HY + arsettings.y, arsettings.w, arsettings.h, arsettings.bg, arcorn[1], arcorn[2], arcorn[3], arcorn[4] )
	end
	if Armor > 0 then
		if arsettings.center == true then
			draw.RoundedBoxEx(arsettings.bordersize, HX + arsettings.x, HY + arsettings.y, (HW - (arsettings.x * 2)) * Armor / 100, arsettings.h, arsettings.fg, arcorn[1], arcorn[2], arcorn[3], arcorn[4] )
		else
			draw.RoundedBoxEx(arsettings.bordersize, HX + arsettings.x, HY + arsettings.y, arsettings.w * Armor / 100, arsettings.h, arsettings.fg, arcorn[1], arcorn[2], arcorn[3], arcorn[4] )
		end
	end
	if arsettings.text == true then
		surface.SetFont("ARFONT")
		local atxtsize = surface.GetTextSize( "Armor: "..Armor )
		if arsettings.textcenter == true then
			draw.DrawText("Armor: "..Armor, "ARFONT", HX + (HW / 2) - (atxtsize / 2), HY + arsettings.texty, Color(255,255,255,255), TEXT_ALIGN_LEFT)
		else
			draw.DrawText("Armor: "..Armor, "ARFONT", HX + arsettings.textx, HY + arsettings.texty, Color(255,255,255,255), TEXT_ALIGN_LEFT)			
		end
	end		
end

hook.Add("HUDPaint", "DarkRP_Mod_HUDPaint", hudPaint)

gg OP…GG…
Jk, remove on the first block the space

[lua] Code [/lua]

https://photos-4.dropbox.com/t/0/AADuMuK_vlCg-Ktn4NenLAFuZvPCWWavuWv5nBVoxJaqpA/12/251205348/jpeg/1024x768/3/1394150400/0/2/2014-03-06_19-56-05.jpg/khLLvoSZ05FoEggbx2glg8E_9ugp-uCfC8ZYNM4q8Vo

Lmao sorry!

Can you remove the code from your other post?

There.

What is HUDSettings.theme? That’s not a default DarkRP HUD variable.

I know, basically I had a Coderhire HUD, but I decided to delete all my Coderhire addons and change the Hud to something else, now I think that is still the one from the Coderhire one. You wouldn’t happen to have the default one that I could copy and past would you?

Just delete the HUD modification.

Where is that located? Sorry for the inconvenience.

addons/darkrpmodification-master/lua/darkrp_modules/hudreplacement/cl_hudreplacement.lua

Yeah I know that, but I meant like, what part do I delete? The whole folder? Or just like a part of it?

The whole file.

Thank you.