Why doesn't my custom scoreboard work on my gamemode when the gamemode is derived from Base?
It works fine when my gamemode is derived from Sandbox
EDIT: Actually, in a way, it works. It shows up, but there are no players on it, and the old Scoreboard still shows(and works). And the mouse doesn't disappear after letting go of tab.
[lua]function ScoreboardShow()
GAMEMODE.ShowScoreboard = true
gui.EnableScreenClicker( true )
return true
end
hook.Add( "ScoreboardShow", "Show", ScoreboardShow )
function ScoreboardHide()
GAMEMODE.ShowScoreboard = false
end
hook.Add( "ScoreboardHide", "Hide", ScoreboardHide )
function HUDDrawScoreBoard()
if not GAMEMODE.ShowScoreboard then return true end
local bgcolor = Color( 65, 65, 65, 255 )
--bgcolor = Color( 24, 116, 205, 255 )
local scolor = Color( 0, 195, 255, 255 )
local ccolor = Color( 0, 195, 35, 255 )
local x = 6
local y = 2
DrawBox( 0, 36, 535, 13, bgcolor, 2 )
for k,v in pairs(player.GetAll()) do
DrawBox( 0, 37 + (k * 12), 534, 13, bgcolor, 2 )
surface.SetDrawColor(Color( 165, 165, 165, 255 ))
surface.DrawOutlinedRect(0, 49, 535, y + (k * 12))
if #player.GetAll() <= 1 then
DrawText( #player.GetAll().." player on "..string.Replace( game.GetMap(), "_", "-" ), "UiBold", 3, 36, Color( 255, 140, 50, 255 ))
else
DrawText( #player.GetAll().." players on "..game.GetMap(), "UiBold", 3, 36, Color( 255, 140, 50, 255 ) )
end
if gamemode.Get("sandbox") then
props = (
v:GetCount( "props" ) +
v:GetCount( "ragdolls" ) +
v:GetCount( "effects" ) +
v:GetCount( "vehicles" ) +
v:GetCount( "npcs" ) +
v:GetCount( "hoverballs" ) +
v:GetCount( "thrusters" ) +
v:GetCount( "balloons" ) +
v:GetCount( "buttons" ) +
v:GetCount( "dynamite" ) +
v:GetCount( "sents" ) +
v:GetCount( "lights" ) +
v:GetCount( "lamps" )
)
DrawText( v:Nick(), "BudgetLabel", 3, 36 + (k * 12), team.GetColor(v:Team()) )
DrawText( props, "BudgetLabel", 302, 36 + ( k * 12 ), ccolor )
DrawText( "Props", "DefaultUnderline", 302, 35, scolor )
surface.DrawLine( 300, 49, 300, 51 + (k * 12) )
end
DrawText( "Kills", "DefaultUnderline", 355, 35, scolor )
surface.DrawLine( 353, 49, 353, 51 + (k * 12) )
DrawText( v:Frags(), "BudgetLabel", 355, 36 + (k * 12), ccolor )
DrawText( "Deaths", "DefaultUnderline", 400, 35, scolor )
surface.DrawLine( 398, 49, 398, 51 + (k * 12) )
DrawText( v:Deaths(), "BudgetLabel", 400, 36 + (k * 12), ccolor )
DrawText( "Ping", "DefaultUnderline", 449, 35, scolor )
surface.DrawLine( 447, 49, 447, 51 + (k * 12) )
DrawText( v:Ping(), "BudgetLabel", 449, 36 + (k * 12), ccolor )
DrawText( "Status", "DefaultUnderline", 490, 35, scolor )
surface.DrawLine( 488, 49, 488, 51 + (k * 12) )
if v:IsAdmin() then
DrawPText( "(Admin)", "UiBold", 490, 37 + (k * 12), Color(160, 255, 25, 255) )
else
DrawText( "(Guest)", "UiBold", 490, 37 + (k * 12), Color( 160, 255, 25, 255 ) )
end
end
end
hook.Add( "HUDDrawScoreBoard", "Draw", HUDDrawScoreBoard )[/lua]
Are there any errors in the console? It will be in yellow text
There are no errors
EDIT: Actually, in a way, it works. It shows up, but there are no players on it, and the old Scoreboard still shows(and works). And the mouse doesn't disappear after letting go of tab.
Eh, might be wrong, correct me if i am.
On line 73
[lua]
if v:IsAdmin() then
DrawPText( "(Admin)", "UiBold", 490, 37 + (k * 12), Color(160, 255, 25, 255) )
[/lua]
Shoudln't it just be
[lua]
if v:IsAdmin() then
DrawText( "(Admin)", "UiBold", 490, 37 + (k * 12), Color(160, 255, 25, 255) )
[/lua]
[QUOTE=zynga;30129370]Eh, might be wrong, correct me if i am.
On line 73
[lua]
if v:IsAdmin() then
DrawPText( "(Admin)", "UiBold", 490, 37 + (k * 12), Color(160, 255, 25, 255) )
[/lua]
Shoudln't it just be
[lua]
if v:IsAdmin() then
DrawText( "(Admin)", "UiBold", 490, 37 + (k * 12), Color(160, 255, 25, 255) )
[/lua][/QUOTE]
nope.
You need to override the base gamemode hooks for it example
[lua]function GM:hookname() end[/lua]
Bump.
[QUOTE=King Flawless;30149686]You need to override the base gamemode hooks for it example
[lua]function GM:hookname() end[/lua][/QUOTE]
wait what?
[b][url=http://wiki.garrysmod.com/?title=Player.GetCount]Player.GetCount [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] doesn't exist in base, unless you've made it yourself.
yeah, that's why I have the "if gamemode.Get("sandbox") then" part
Don't you want to override the functions, rather than add to them?
Sorry, you need to Log In to post a reply to this thread.