• TTT Scoreboard ranks.
    6 replies, posted
I have seen a few posts by people about a "Ranks" on the scoreboard. I have seen this code. This did work but I can't add more groups in. If anyone could help it would be grateful. Just add my steam [CODE]Just do this Go to your terrortown/gamemode/vgui/sb_row.lua Add this below function PANEL:Init() 1 2 self.cols[5] = vgui.Create("DLabel", self) self.cols[5]:SetText("Rank") Add this below function PANEL:UpdatePlayerData() 1 2 3 4 if ply:IsUserGroup("superadmin") then self.cols[5]:SetText("SUPERADMIN") self.cols[5]:SetTextColor(Color(255,0,0,255)) end Go to your terrortown/gamemode/vgui/sb_main.lua Find under function PANEL:Init() 1 2 self.cols[3] = vgui.Create( "DLabel", self ) self.cols[3]:SetText( GetTranslation("sb_score") ) Add this under that 1 2 self.cols[5] = vgui.Create( "DLabel", self ) self.cols[5]:SetText("Rank") All you really had to do is look at how the other ones were set and just follow how it's being created. :/. Be sure to do this on the latest svn for terrortown that hasn't been edited.[/CODE]
Is it not just a case of. Add this below function PANEL:UpdatePlayerData() 1 2 3 4 if ply:IsUserGroup("superadmin") then self.cols[5]:SetText("SUPERADMIN") self.cols[5]:SetTextColor(Color(255,0,0,255)) [B]if ply:IsUserGroup("admin") then self.cols[5]:SetText("ADMIN") self.cols[5]:SetTextColor(Color(255,0,0,255))[/B] end ??
[QUOTE=RockstarC;38855178]I have seen a few posts by people about a "Ranks" on the scoreboard. I have seen this code. This did work but I can't add more groups in. If anyone could help it would be grateful. Just add my steam Just do this Go to your terrortown/gamemode/vgui/sb_row.lua Add this below function PANEL:Init() [lua] self.cols[5] = vgui.Create("DLabel", self) self.cols[5]:SetText("Rank") [/lua] Add this below function PANEL:UpdatePlayerData() [lua] if ply:IsUserGroup("superadmin") then self.cols[5]:SetText("SUPERADMIN") self.cols[5]:SetTextColor(Color(255,0,0,255)) end [/lua] Go to your terrortown/gamemode/vgui/sb_main.lua Find under function PANEL:Init() [lua] self.cols[3] = vgui.Create( "DLabel", self ) self.cols[3]:SetText( GetTranslation("sb_score") ) [/lua] Add this under that [lua] self.cols[5] = vgui.Create( "DLabel", self ) self.cols[5]:SetText("Rank") [/lua] [/QUOTE] For the more groups part; just make som copies of this part, and fill inn with whatever usergroups you have created with ULX. [lua] if ply:IsUserGroup("superadmin") then self.cols[5]:SetText("SUPERADMIN") self.cols[5]:SetTextColor(Color(255,0,0,255)) end [/lua] example: If you have a usergroup named "moderator" then it should look like this: [lua] if ply:IsUserGroup("moderator") then self.cols[5]:SetText("[MOD]") self.cols[5]:SetTextColor(Color(150,150,0,255)) end [/lua]
[QUOTE=Jackrevenge;38856506]Is it not just a case of. Add this below function PANEL:UpdatePlayerData() 1 2 3 4 if ply:IsUserGroup("superadmin") then self.cols[5]:SetText("SUPERADMIN") self.cols[5]:SetTextColor(Color(255,0,0,255)) [B]if ply:IsUserGroup("admin") then self.cols[5]:SetText("ADMIN") self.cols[5]:SetTextColor(Color(255,0,0,255))[/B] end ??[/QUOTE] Thanks for all support people! :)
[QUOTE=RockstarC;38864788]Thanks for all support people! :)[/QUOTE] how would i change the font size small?
[QUOTE=Ozhar;38999956]how would i change the font size small?[/QUOTE] "change the font size small" please go. anyway, i have different code for the same thing, but It's overall just one shitty "if" statement that i didn't care to make as an "elseif" and ended up, well... end. But it works. [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) }; 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) if SERVER then AddCSLuaFile("scoreboardcolors.lua") else function MySBColors(ply) if ply:IsUserGroup("superadmin") then return Color(0, 0, 0) else if ply:IsUserGroup("moderator") then return Color(144, 210, 27) else if ply:IsUserGroup("operator") then return Color(0, 255, 255) else if ply:IsUserGroup("respected") then return Color(22, 47, 196) else if ply:IsUserGroup("vip - moderator") then return Color(144, 210, 27) else if ply:IsUserGroup("vip") then return Color(69, 10, 104) else if ply:IsUserGroup("trusted admin") then return Color(255, 84, 0) else if ply:IsUserGroup("co-owner") then return Color(255, 0, 0) else if ply:IsUserGroup("vip - operator") then return Color(0, 255, 255) end end end end end end end end end end hook.Add("TTTScoreboardColorForPlayer", "MySBColors", MySBColors) end 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:GetScoreboardPanel() return sboard_panel end function GM:HUDDrawScoreBoard() -- replaced by panel version end[/lua]
[QUOTE=gmodproblems;39015001]"change the font size small" please go. anyway, i have different code for the same thing, but It's overall just one shitty "if" statement that i didn't care to make as an "elseif" and ended up, well... end. But it works. [lua] function MySBColors(ply) if ply:IsUserGroup("superadmin") then return Color(0, 0, 0) else if ply:IsUserGroup("moderator") then return Color(144, 210, 27) else if ply:IsUserGroup("operator") then return Color(0, 255, 255) else if ply:IsUserGroup("respected") then return Color(22, 47, 196) else if ply:IsUserGroup("vip - moderator") then return Color(144, 210, 27) else if ply:IsUserGroup("vip") then return Color(69, 10, 104) else if ply:IsUserGroup("trusted admin") then return Color(255, 84, 0) else if ply:IsUserGroup("co-owner") then return Color(255, 0, 0) else if ply:IsUserGroup("vip - operator") then return Color(0, 255, 255) end end end end end end end end end end[/lua][/QUOTE] optimization.... learn it best way to do the whole lot is to put it on a table, less server stress blah blah blah
Sorry, you need to Log In to post a reply to this thread.