Getting [error] stack overflow and dont know why

Hi im getting the following error in the below pastebin link could anybody tell me why its doing this?(for custom hud)

My code below

Firstly, in your lovely note:



--You steal this hud your a dick from Ambient


You should be using “you’re” instead. Secondly, you don’t even need to be calling



surface.SetTextColor( 255, 255, 255)


On line 29. There’s no reason to.
Thirdly, here:



draw.DrawText( "Armour:"..EchoArmour, Trebuchet24, width1 - 1545, height1 - 130,Color(255,255,255))


You didn’t put quotes around Trebuchet24, so Lua is interpreting it as a variable.

Fourthly, the main problem is here:



function DrawHUD()
    

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

    --cust2om


    Base()
    --default

    GunLicense()
    Agenda()
    DrawVoiceChat()
    LockDown()
    Arrested()
    AdminTell()

    DrawHUD() -- THIS IS THE PROBLEM MATE
    DrawEntityDisplay()

    self.Sandbox.HUDPaint(self)
end


You’re calling DrawHUD() in the DrawHUD function. Of course it’s going to break.

Fifthly, I noticed you were doing a lot of this kind of stuff:



height1 / 1.2765


Try testing your HUD on other screen resolutions, usually math like that ends up looking pretty awful on other screen sizes

Im getting this new error every now and then

Oh and thanks for all your help, It means alot your taking time out of your day to help

Try printing



LocalPlayer():getDarkRPVar( "job" )


I have no clue why that’d be nil though

http://pastebin.com/XC4dyTdz this is the final error im getting and once again thanks for your help

I think it’s because of this:



self.Sandbox.HUDPaint(self)


Why are you doing that by the way? By using a HUDPaint hook it should call the sandbox HUDPaint if that’s the base gamemode of whatever gamemode you’re using

To stop the defult darkrp hud i think

Look at how DarkRP does it here. It doesn’t use a hook, it just overrides the whole function, which you should probably be doing as well