• TTT Scoreboard
    6 replies, posted
Don't make fun of my coding, i am far from a coder. I am trying to edit the TTT scoreboard and give each usergroup for ULX its own color on the scoreboard. Here is the entire scoreboard.lua I added in lines 11-25 [lua] -- a much requested darker scoreboard local table = table local surface = surface local draw = draw local math = math local team = team local namecolor = { admin = Color(220, 180, 0, 255), default = COLOR_WHITE, superadmin = Color(255, 165, 0, 255), owner = Color(255, 0, 0, 255), moderator = Color(30, 144, 255, 255), donator = Color(124, 252, 0, 255) }; local function ColorForPlayer(ply) if IsValid(ply) then if ply:IsUserGroup("owner") then return namecolor.owner end end return namecolor.default end include("vgui/sb_main.lua") sboard_panel = nil local function ScoreboardRemove() if sboard_panel then sboard_panel:Remove() sboard_panel = nil end end hook.Add("TTTLanguageChanged", "RebuildScoreboard", ScoreboardRemove) function GM:ScoreboardCreate() ScoreboardRemove() sboard_panel = vgui.Create("TTTScoreboard") end function GM:ScoreboardShow() self.ShowScoreboard = true if not sboard_panel then self:ScoreboardCreate() end gui.EnableScreenClicker(true) sboard_panel:SetVisible(true) sboard_panel:UpdateScoreboard(true) sboard_panel:StartUpdateTimer() end function GM:ScoreboardHide() self.ShowScoreboard = false gui.EnableScreenClicker(false) if sboard_panel then sboard_panel:SetVisible(false) end end function GM:HUDDrawScoreBoard() -- replaced by panel version end [/lua]
Try this instead [lua] -- a much requested darker scoreboard local table = table local surface = surface local draw = draw local math = math local team = team local namecolor = { admin = Color(220, 180, 0, 255), default = COLOR_WHITE, superadmin = Color(255, 165, 0, 255), owner = Color(255, 0, 0, 255), moderator = Color(30, 144, 255, 255), donator = Color(124, 252, 0, 255) }; local function ColorForPlayer(ply) if IsValid(ply) then if ply:IsUserGroup("owner") then return namecolor.owner elseif ply:IsUserGroup("admin") then return namecolor.admin elseif ply:IsUserGroup("superadmin") then return namecolor.superadmin elseif ply:IsUserGroup("moderator") then return namecolor.moderator elseif ply:IsUserGroup("donator") then return namecolor.donator end return namecolor.default end include("vgui/sb_main.lua") sboard_panel = nil local function ScoreboardRemove() if sboard_panel then sboard_panel:Remove() sboard_panel = nil end end hook.Add("TTTLanguageChanged", "RebuildScoreboard", ScoreboardRemove) function GM:ScoreboardCreate() ScoreboardRemove() sboard_panel = vgui.Create("TTTScoreboard") end function GM:ScoreboardShow() self.ShowScoreboard = true if not sboard_panel then self:ScoreboardCreate() end gui.EnableScreenClicker(true) sboard_panel:SetVisible(true) sboard_panel:UpdateScoreboard(true) sboard_panel:StartUpdateTimer() end function GM:ScoreboardHide() self.ShowScoreboard = false gui.EnableScreenClicker(false) if sboard_panel then sboard_panel:SetVisible(false) end end function GM:HUDDrawScoreBoard() -- replaced by panel version end [/lua] Haven't tested it so tell me if it works. Its not the best way of doing it im sure but it should work
You forgot an "end" and its the same code I have you just added in the other groups? The problem is the code i made *lines 11 to 25* is not working.
Does it give an error? or just doesn't do anything?
No errors or anything just doesn't work
Why edit the scoreboard? Just use the TTTScoreboardColorForPlayer hook. [url]http://ttt.badking.net/guides/hooks[/url]
yay my code was right i just had to put it in sb_row its a similar file to the scoreboard
Sorry, you need to Log In to post a reply to this thread.