So I was having problems with my previous scoreboard so I moved to another one then I got the same error so I wan't to see if anyone can help me with this.
In console it displays:
[ERROR] gamemodes/darkrp/gamemode/modules/fadmin/fadmin/cl_interface/cl_scoreboard.lua:122: 'ScoreboardHead' isn't a valid font
1.SetFont - [C]:-1
2. unkown - gamemodes/darkrp/gamemode/modules/fadmin/fadmin/cl_interface/cl_scoreboard.lua:122
And heres what the code near line 122 looks like:
[CODE]local hostname = GetGlobalString( "ServerName" )
local gamemodeName = GAMEMODE.Name .. " - " .. GAMEMODE.Author
surface.SetTextColor( 255, 255, 255, 255 )
if ( string.len(hostname) > 32 ) then
surface.SetFont( "ScoreboardSub" )
else
surface.SetFont( "ScoreboardHead" )
end
local txWidth, txHeight = surface.GetTextSize( hostname )
local y = yOffset + 15
surface.SetTextPos(xOffset + (boardWidth / 2) - (txWidth/2), y)
surface.DrawText( hostname )
y = y + txHeight + 2
[/CODE]
I think part of the problem is that it says font and Scoreboardhead is put there instead of like a font but im really not sure im not that great at lua
The error speaks for itself, the font ScoreboardHead doesn't exist. Considering that it's an "if then else" statement, the other font ScoreboardSub probably doesn't exist either. Change them both to default for an easy fix.
[lua]
local hostname = GetGlobalString( "ServerName" )
local gamemodeName = GAMEMODE.Name .. " - " .. GAMEMODE.Author
surface.SetTextColor( 255, 255, 255, 255 )
if ( string.len(hostname) > 32 ) then
surface.SetFont( "Default" )
else
surface.SetFont( "Default" )
end
local txWidth, txHeight = surface.GetTextSize( hostname )
local y = yOffset + 15
surface.SetTextPos(xOffset + (boardWidth / 2) - (txWidth/2), y)
surface.DrawText( hostname )
y = y + txHeight + 2
[/lua]
Are you fixing up an old scoreboard? I think I've had this problem before and if I recall, you can fix it by simply creating the font via surface.CreateFont
[url]http://wiki.garrysmod.com/page/surface/CreateFont[/url]
Ok, im done with this scoreboard because so far I have fixed at least 23 errors and im getting more. Does anyone know where I can get the default DarkRP scoreboard?
Sorry, you need to Log In to post a reply to this thread.