My hud is broken :'( Can anyone please fix?

I use the Sany Allice V3 Hud but when you get a license you get script errors instead, this maybe because I think it was made for darkrp 2.4?
–[[

Copyright (C) 2013 SanyHUD V3

This file is part of SanyHUD V3

SanyHUD V3 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

SanyHUD V2 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with SanyHUD V3.  If not, see <http://www.gnu.org/licenses/>.

–]]

-- Settings
local ArmorOrHunger		= 2		-- Armor or hunger (1=Armor, 2=Hunger)
local ServerName		= "SanyAlliance"

-- Colors
local BorderColor 		= Color(0,0,0,200)
local ArmorHungerColor	= Color(50,150,250,255)
local HealthColor		= Color(255,0,0,255)

local SalaryColor		= Color(0,250,0,255)
local WalletColor		= Color(0,250,0,255)

-- Var
local Health 		= 0
local Armor 		= 0
local Hunger 		= 0

local hideHUDElements = {
[“DarkRP_HUD”] = true,
[“DarkRP_EntityDisplay”] = false,
[“DarkRP_ZombieInfo”] = false,
[“DarkRP_LocalPlayerHUD”] = true,
[“DarkRP_Agenda”] = false,
[“DarkRP_Hungermod”] = true,
}
hook.Add(“HUDShouldDraw”, “HideDefaultDarkRPHud”, function(name)
if hideHUDElements[name] then return false end
end)

local ConVars = {}
local HUDWidth
local HUDHeight

local Color = Color
local cvars = cvars
local draw = draw
local GetConVar = GetConVar
local Lerp = Lerp
local localplayer
local pairs = pairs
local SortedPairs = SortedPairs
local string = string
local surface = surface
local table = table
local tostring = tostring

local Scrw, Scrh, RelativeX, RelativeY

CreateClientConVar("weaponhud", 0, true, false)

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

--[[
		Base
--]]
local function Base()

	draw.RoundedBox(0, 10, ScrH() - 198, 425 + 4, 188, Color(0,0,0,200))

	draw.RoundedBoxEx(6, 10, ScrH() - 210, 425 + 4, 12, BorderColor, true, true, false, false)
	draw.RoundedBoxEx(6, 10, ScrH() - 210, 425 + 4, 12, BorderColor, true, true, false, false)
	draw.DrawText("-----------------------------------------------------------", "HudSelectionText", 18, ScrH()-212, Color(255,255,255,255), TEXT_ALIGN_LEFT)		
	
	-- Borders (Left, Right, Bottom)
	draw.RoundedBox(0, 10, ScrH() - 200, 2, 190, BorderColor)
	draw.RoundedBox(0, 437, ScrH() - 200, 2, 190, BorderColor)
	draw.RoundedBox(0, 12, ScrH() - 12, 425, 2, BorderColor)
	
	-- Boxes (Armor/Hunger, Health)
	draw.RoundedBox(0, 12, ScrH() - 41, 425, 24, Color(0,0,0,200))
	draw.RoundedBox(0, 12, ScrH() - 70, 425, 24, Color(0,0,0,200))
	
	-- Boxes (Salary, Wallet)
	draw.RoundedBox(0, 12, ScrH() - 100, 200, 24, Color(0,0,0,200))
	draw.RoundedBox(0, 237, ScrH() - 100, 200, 24, Color(0,0,0,200))
	
	-- Boxes (Name, Job)
	draw.RoundedBox(0, 115, ScrH() - 131, 322, 24, Color(0,0,0,200))
	draw.RoundedBox(0, 115, ScrH() - 160, 322, 24, Color(0,0,0,200))
	draw.RoundedBox(0, 115, ScrH() - 190, 322, 24, Color(0,0,0,200))
	
end

--[[
		Armor
--]]
local function Armor()

	local Armor 	= LocalPlayer():Armor() or 0
	local Hunger 	= math.ceil(LocalPlayer():getDarkRPVar("Energy") or 0)
	
	if ArmorOrHunger == 1 then
		draw.RoundedBox(0, 16, ScrH() - 39, 417 * Armor / 100, 20, ArmorHungerColor)
		draw.RoundedBox(0, 16, ScrH() - 39, 417 * Armor / 100, 10, Color(255,255,255,10))
		draw.DrawText("Armor: "..Armor.."%", "HudSelectionText", 21, ScrH()-36, Color(0,0,0,255), TEXT_ALIGN_LEFT)
		draw.DrawText("Armor: "..Armor.."%", "HudSelectionText", 20, ScrH()-37, Color(255,255,255,255), TEXT_ALIGN_LEFT)
	else
		draw.RoundedBox(0, 16, ScrH() - 39, 417 * Hunger / 100, 20, ArmorHungerColor)
		draw.RoundedBox(0, 16, ScrH() - 39, 417 * Hunger / 100, 10, Color(255,255,255,10))	
		draw.DrawText("Hunger: "..Hunger.."%", "HudSelectionText", 21, ScrH()-36, Color(0,0,0,255), TEXT_ALIGN_LEFT)
		draw.DrawText("Hunger: "..Hunger.."%", "HudSelectionText", 20, ScrH()-37, Color(255,255,255,255), TEXT_ALIGN_LEFT)
	end

end

--[[
		Health
--]]
local function Health()

	local Health		= LocalPlayer():Health() or 0
	if Health < 0 then Health = 0 end
	local DrawHealth 	= math.Min(Health / GAMEMODE.Config.startinghealth, 1)

	draw.RoundedBox(0, 16, ScrH() - 68, 417 * DrawHealth, 20, HealthColor)
	draw.RoundedBox(0, 16, ScrH() - 68, 417 * DrawHealth, 10, Color(255,255,255,10))
	draw.DrawText("Health: "..Health.."%", "HudSelectionText", 21, ScrH()-65, Color(0,0,0,255), TEXT_ALIGN_LEFT)
	draw.DrawText("Health: "..Health.."%", "HudSelectionText", 20, ScrH()-66, Color(255,255,255,255), TEXT_ALIGN_LEFT)

end

--[[
		Job
--]]
local function Job()

	local Job = LocalPlayer():getDarkRPVar("job") or ""
	
	draw.DrawText("Job: "..Job, "HudSelectionText", 121, ScrH() - 155, Color(0,0,0,255), TEXT_ALIGN_LEFT)
	draw.DrawText("Job: "..Job, "HudSelectionText", 120, ScrH() - 156, Color(255,255,255,255), TEXT_ALIGN_LEFT)

end

--[[
		Server
--]]
local function Server()
	
	draw.DrawText("Server: "..ServerName, "HudSelectionText", 121, ScrH() - 185, Color(0,0,0,255), TEXT_ALIGN_LEFT)
	draw.DrawText("Server: "..ServerName, "HudSelectionText", 120, ScrH() - 186, Color(255,255,255,255), TEXT_ALIGN_LEFT)

end

--[[
		Salary
--]]
local function Salary()

	local Salary = "Salary: $"..formatNumber(LocalPlayer():getDarkRPVar("salary") or 0)
	
	draw.DrawText(Salary, "HudSelectionText", 111, ScrH() - 96, Color(0,0,0,255), TEXT_ALIGN_CENTER)
	draw.DrawText(Salary, "HudSelectionText", 110, ScrH() - 97, SalaryColor, TEXT_ALIGN_CENTER)
	
end

--[[
		Wallet
--]]
local function Wallet()	

	local Wallet = "Wallet: $"..formatNumber(LocalPlayer():getDarkRPVar("money") or 0)
	
	draw.DrawText(Wallet, "HudSelectionText", 338, ScrH() - 96, Color(0,0,0,255), TEXT_ALIGN_CENTER)
	draw.DrawText(Wallet, "HudSelectionText", 337, ScrH() - 97, WalletColor, TEXT_ALIGN_CENTER)

end

--[[
		Avatar
--]]
AvatarC = 0
local function Avatar()
	
	if AvatarC == 0 then
		AvatarC = 1
		local Avatar = vgui.Create( "AvatarImage" )
		Avatar:SetSize( 84,84 )
		Avatar:SetPos( 20, ScrH() - 191 )
		Avatar:SetPlayer( LocalPlayer(), 64 )
	end
	
end

--[[
		Name
--]]
local function Name()	

	local Name = "Name: "..LocalPlayer():Nick()
	
	draw.DrawText(Name, "HudSelectionText", 121, ScrH() - 127, Color(0,0,0,255), TEXT_ALIGN_LEFT)
	draw.DrawText(Name, "HudSelectionText", 120, ScrH() - 128, Color(255,255,255,255), TEXT_ALIGN_LEFT)

end

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 shouldDraw = hook.Call(“HUDShouldDraw”, GAMEMODE, “DarkRP_Agenda”)
if shouldDraw == false then return end
local DrawAgenda, AgendaManager = DarkRPAgendas[LocalPlayer():Team()], LocalPlayer():Team()
if not DrawAgenda then
for k,v in pairs(DarkRPAgendas) do
if table.HasValue(v.Listeners or {}, LocalPlayer():Team()) then
DrawAgenda, AgendaManager = DarkRPAgendas[k], k
break
end
end
end
if DrawAgenda then
draw.RoundedBox(10, 10, 10, 460, 110, Color(0, 0, 0, 155))
draw.RoundedBox(10, 12, 12, 456, 106, Color(51, 58, 51,100))
draw.RoundedBox(10, 12, 12, 456, 20, Color(0, 0, 70, 100))

            draw.DrawText(DrawAgenda.Title, "DarkRPHUD1", 30, 12, Color(255,0,0,255),0)

            local AgendaText = {}
            for k,v in pairs(team.GetPlayers(AgendaManager)) do
                    if not v.DarkRPVars then continue end
                    table.insert(AgendaText, v:getDarkRPVar("agenda"))
            end

            local text = table.concat(AgendaText, "

“)
text = text:gsub(”//", "
“):gsub(”
", "
")
text = DarkRP.textWrap(text, “DarkRPHUD1”, 440)
draw.DrawText(text, “DarkRPHUD1”, 30, 35, Color(255,255,255,255),0)
end
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(140,0,0,180)
            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.DrawText(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.DrawText(DarkRP.getPhrase("youre_arrested", math.ceil(ArrestedUntil - (CurTime() - StartArrested))), "DarkRPHUD1", ScrW()/2, ScrH() - ScrH()/12, Color(255,255,255,255), 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, Color(0, 0, 0, 200))
            draw.DrawText(DarkRP.getPhrase("listen_up"), "GModToolName", ScrW() / 2 + 10, 10, Color(255, 255, 255, 255), 1)
            draw.DrawText(Message, "ChatFont", ScrW() / 2 + 10, 80, Color(200, 30, 30, 255), 1)
    end

    timer.Create("DarkRP_AdminTell", 10, 1, function()
            AdminTell = function() end
    end)

end)

local function DrawHUD()
Base()
Armor()
Health()
Job()
Salary()
Wallet()
Name()
Avatar()
Server()

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

end

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.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( Material( "icon16/page_white_text.png" ) )
	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.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)
end

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

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

end

/---------------------------------------------------------------------------
The Entity display: draw HUD information about entities
---------------------------------------------------------------------------
/
local function DrawEntityDisplay()
local shouldDraw = 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(player.GetAll()) do
	if not ply:Alive() then continue end
	local hisPos = ply:GetShootPos()
	if ply:getDarkRPVar("wanted") then DrawWantedInfo(ply) end

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

/---------------------------------------------------------------------------
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)

/---------------------------------------------------------------------------
Actual HUDPaint hook
---------------------------------------------------------------------------
/
function painthud()
DrawHUD()
DrawEntityDisplay()
end

hook.Add(“HUDPaint”, “painthud”, painthud)

local tohide = { – This is a table where the keys are the HUD items to hide
[“CHudHealth”] = true,
[“CHudBattery”] = true
}
local function HUDShouldDraw(name)
if (tohide[name]) then
return false;
end
end
hook.Add(“HUDShouldDraw”, “darkrphudShouldDraw”, HUDShouldDraw)


(User was banned for this post ("wrong section" - postal))

Couldn’t you just use Pastebin to paste this huge piece of Text?

If you want people to help you, post any errors you’re getting from this or explain it better then just dumping your code and leaving it at that. I’d suggest you do what SpookyWookie said and paste all that on pastebin and then send us the link.

[lua]
if ply:getDarkRPVar(“HasGunlicense”) then
surface.SetMaterial( Material( “icon16/page_white_text.png” ) )
surface.SetDrawColor(255,255,255,255)
surface.DrawTexturedRect(pos.x-16, pos.y + 60, 32, 32)
[/lua]

  1. [ lua] [ /lua] tags around code
  2. Error Code?

My hud is broken :’( Can anyone please fix?”

cough bullshit cough

Why not ask the creator?

Oh god, what have you done…

Also, this is the Garry’s Mod Discussion Forum. Support post goes on the HELP & SUPPORT Forum :slight_smile:

Developer discussion is for lua help. Read the sticky in the Help & Support forum.

Hey where do I put that in the code?

What happened here?
local Salary = “Salary: $”…formatNumber(LocalPlayer():getDarkRPVar(“salar y”) or 0)

Should be:
local Salary = “Salary: $”…formatNumber(LocalPlayer():getDarkRPVar(“salary”) or 0)