I am starting up my new custom DarkRP server, but it seems all the custom huds I use, even mine, it gives me the lua error:
[ERROR] gamemodes/darkrp/gamemode/client/hud.lua:301: attempt to index global 'LANGUAGE' (a nil value)
1. DrawPlayerInfo - gamemodes/darkrp/gamemode/client/hud.lua:301
2. DrawEntityDisplay - gamemodes/darkrp/gamemode/client/hud.lua:358
3. unknown - gamemodes/darkrp/gamemode/client/hud.lua:391
Any idea whats going on? Thanks.
I'm willing to bet that's the font. Post an example of where that variable is used.
Fptje changed orders now we have put the following code
DarkRP.getPhrase("job", localplayer:getDarkRPVar("job") or ""), "\n",
[code]/*---------------------------------------------------------------------------
HUD ConVars
---------------------------------------------------------------------------*/
local ConVars = {}
local HUDWidth
local HUDHeight
CreateClientConVar("weaponhud", 0, true, false)
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 function formatNumber(n)
n = tonumber(n)
if (!n) then
return 0
end
if n >= 1e14 then return tostring(n) end
n = tostring(n)
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
local Scrw, Scrh, RelativeX, RelativeY
/*---------------------------------------------------------------------------
HUD Seperate Elements
---------------------------------------------------------------------------*/
surface.CreateFont( "ps_DataText", {
font = "Arial",
size = 16,
weight = 300,
antialias = true
} );
surface.CreateFont( "ps_HUDFont", {
font = "Tahoma",
size = 14,
weight = 400,
antialias = true,
outline = true
} );
surface.CreateFont( "ps_TipFont", {
font = "Tahoma",
size = 14,
weight = 400,
antialias = true,
outline = true
} );
surface.CreateFont( "ps_TargetFontLarge", {
font = "Tahoma",
size = 24,
weight = 800,
antialias = true,
outline = true
} );
---------
function DrawUpperInfo(x, y, icon, text, shouldDrawCallback, alpha)
local shouldDraw = true;
if (!alpha) then
alpha = 255;
end;
if (shouldDrawCallback) then
shouldDraw = shouldDrawCallback(x, y);
end;
if (shouldDraw != false) then
surface.SetFont("ps_HUDFont");
local width, height = surface.GetTextSize(text or "");
if (width + 12 + x + 32 > ScrW()) then
x = 8;
y = y + 30;
end;
draw.RoundedBox( 4, x, y, 26, 26, Color(0, 0, 0, alpha * 0.78) );
surface.SetDrawColor(250, 250, 250, 8);
surface.DrawRect(x + 3, y + 3, 20, 20);
surface.SetDrawColor(255, 255, 255, alpha);
surface.SetMaterial( Material(icon) );
surface.DrawTexturedRect(x + 5, y + 5, 16, 16);
draw.RoundedBox( 4, x + 26 + 4, y, width + 12, 26, Color(0, 0, 0, alpha * 0.78) );
surface.SetDrawColor(250, 250, 250, alpha * 0.031);
surface.DrawRect(x + 33, y + 3, width + 6, 20);
draw.SimpleText(text, "ps_HUDFont", x + 36, y + 13, Color(255, 255, 255, alpha), 0, 1);
local totalHeight = y;
local totalWidth = (width + 12) + x + 34;
if (totalWidth >= ScrW()) then
totalHeight = y + 30;
totalWidth = 8;
end;
return totalWidth, totalHeight;
else
return x, y;
end;
end;
local function DrawInfo()
local x, y = 8, ScrH()-32;
LocalPlayer().DarkRPVars = LocalPlayer().DarkRPVars or {}
local salary = (LocalPlayer().DarkRPVars.salary or 0)
local job = LocalPlayer().DarkRPVars.job or "Unemployed"
local wallet = (formatNumber(LocalPlayer().DarkRPVars.money) or 0)
local health = LocalPlayer():Health();
local armor = LocalPlayer():Armor();
local licence = LocalPlayer().DarkRPVars.HasGunlicense
x, y = DrawUpperInfo(x, y, "icon16/world.png", "INDEV");
x, y = DrawUpperInfo(x, y, "icon16/coins.png", "Wallet: $"..wallet);
x, y = DrawUpperInfo(x, y, "icon16/wrench.png", "Job: "..job, function(x, y)
return string.lower(job) != "unemployed";
end);
x, y = DrawUpperInfo(x, y, "icon16/coins_add.png", "Salary: $".. salary);
x, y = DrawUpperInfo(x, y, "icon16/heart.png", "Health: "..health);
x, y = DrawUpperInfo(x, y, "icon16/shield.png", "Armor: "..armor, function(x, y)
return armor > 0;
end);
x, y = DrawUpperInfo(x, y, "icon16/page_white_text.png", "Licence Granted", function(x, y)
return licence==1;
end);
local activeWeapon = LocalPlayer():GetActiveWeapon();
if ( IsValid(activeWeapon) ) then
local clipText1 = activeWeapon:Clip1()
local clipText2 = LocalPlayer():GetAmmoCount(activeWeapon:GetPrimaryAmmoType())
if(clipText2>0) then
x, y = DrawUpperInfo(x, y, "icon16/gun.png", "Ammo: "..clipText1.."/"..clipText2, function()
local blacklist = {
"weapon_physgun",
"weapon_physcannon",
"gmod_tool",
"keys",
"pocket",
"keypad_cracker",
"lockpick",
"weaponchecker",
"arrest_stick",
"unarrest_stick",
"stunstick",
"gmod_camera",
"door_ram"
};
return !table.HasValue( blacklist, string.lower( activeWeapon:GetClass() ) );
end);
else
x, y = DrawUpperInfo(x, y, "icon16/gun.png", "Ammo: "..clipText1, function()
local blacklist = {
"weapon_physgun",
"weapon_physcannon",
"gmod_tool",
"keys",
"pocket",
"weapon_keypadcracker",
"weaponchecker",
"arrest_stick",
"unarrest_stick",
"stunstick",
"camera",
"door_ram"
};
return !table.HasValue( blacklist, string.lower( activeWeapon:GetClass() ) );
end);
end
end;
end
local Page = Material("icon16/page_white_text.png")
local function GunLicense()
if LocalPlayer().DarkRPVars.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 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
AgendaText = AgendaText .. (v.DarkRPVars.agenda or "") .. "\n"
end
draw.DrawText(string.gsub(string.gsub(AgendaText, "//", "\n"), "\\n", "\n"), "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(ConVars.Healthforeground)
surface.DrawTexturedRectRotated(ScrW() - 100, chboxY, Rotating*96, 96, backwards)
end
end
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.DrawT
Add me on Steam : reggae59
And i help you fast^^
Its not coming up when I search for you.
If you need help add me ^^ or bye^^
Added.
Sorry, you need to Log In to post a reply to this thread.