• TTT Scoreboard, Quick question
    11 replies, posted
Hello, I hope you're all having a great day. I've been working on a TTT server with a friend lately, I have a good understanding of LUA. I added a scoreboard the other day and got my rank column and other thing set up. It's putting my usergroup on the scoreboard in a place I do not want it to be, after editing sb_row and sb_main for a good half hour, the usergroup tag will not move. [IMG]http://i.imgur.com/33z4trD.jpg[/IMG]
Post your column code.
[QUOTE=code_gs;44511508]Post your column code.[/QUOTE] sb_row.lua [code]function PANEL:LayoutColumns() for k,v in ipairs(self.cols) do v:SizeToContents() v:SetPos(self:GetWide() - (85*k) - v:GetWide()/2, (SB_ROW_HEIGHT - v:GetTall()) / 2) end self.tag:SizeToContents() self.tag:SetPos(self:GetWide()/1.4 - (50 * 6) - self.tag:GetWide()/2, (SB_ROW_HEIGHT - self.tag:GetTall()) / 2) self.sresult:SetPos(self:GetWide() - (50*6) - 8, (SB_ROW_HEIGHT - 16) / 2) end [/code] [code] -- the various score column headers self.cols = {} self.cols[1] = vgui.Create( "DLabel", self ) self.cols[1]:SetText( GetTranslation("sb_ping") ) self.cols[2] = vgui.Create( "DLabel", self ) self.cols[2]:SetText( GetTranslation("sb_deaths") ) self.cols[3] = vgui.Create( "DLabel", self ) self.cols[3]:SetText( GetTranslation("sb_score") ) if KARMA.IsEnabled() then self.cols[4] = vgui.Create("DLabel", self) self.cols[4]:SetText(GetTranslation("sb_karma")) end self.cols[5] = vgui.Create( "DLabel", self ) self.cols[5]:SetText("Rank") [/code] sb_main.lua [code] -- score columns for k,v in ipairs(self.cols) do v:SizeToContents() v:SetPos( w - (85*k) - v:GetWide()/2 - 8, 75) end [/code]
Not that, your tab positioning code, such as your rank column.
[QUOTE=code_gs;44511897]Not that, your tab positioning code, such as your rank column.[/QUOTE] I posted the positioning code for the column, I apologize if I sound stupid, but could you be a bit more specific?
[QUOTE=SeniorDerp;44511920]I posted the positioning code for the column, I apologize if I sound stupid, but could you be a bit more specific?[/QUOTE] Sorry, you edited your post with the code and I hadn't refreshed the page. You're using outdated column code. New columns look like this: [code] self.cols = {} self:AddColumn( GetTranslation("sb_ping"), function(ply) return ply:Ping() end ) self:AddColumn( GetTranslation("sb_deaths"), function(ply) return ply:Deaths() end ) self:AddColumn( GetTranslation("sb_score"), function(ply) return ply:Frags() end ) if KARMA.IsEnabled() then self:AddColumn( GetTranslation("sb_karma"), function(ply) return math.Round(ply:GetBaseKarma()) end ) end[/code] So your new rank column will look like this: [code]self:AddColumn( "Rank", function(ply) return ply:GetUserGroup() end )[/code]
[QUOTE=code_gs;44512097]Sorry, you edited your post with the code and I hadn't refreshed the page. You're using outdated column code. New columns look like this: [code] self.cols = {} self:AddColumn( GetTranslation("sb_ping"), function(ply) return ply:Ping() end ) self:AddColumn( GetTranslation("sb_deaths"), function(ply) return ply:Deaths() end ) self:AddColumn( GetTranslation("sb_score"), function(ply) return ply:Frags() end ) if KARMA.IsEnabled() then self:AddColumn( GetTranslation("sb_karma"), function(ply) return math.Round(ply:GetBaseKarma()) end ) end[/code] So your new rank column will look like this: [code]self:AddColumn( "Rank", function(ply) return ply:GetUserGroup() end )[/code][/QUOTE] [code] [ERROR] gamemodes/terrortown/gamemode/vgui/sb_row.lua:42: attempt to call method 'AddColumn' (a nil value) 1. Init - gamemodes/terrortown/gamemode/vgui/sb_row.lua:42 2. Create - lua/includes/extensions/client/panel/scriptedpanels.lua:153 3. AddPlayerRow - gamemodes/terrortown/gamemode/vgui/sb_team.lua:76 4. UpdateScoreboard - gamemodes/terrortown/gamemode/vgui/sb_main.lua:426 5. Init - gamemodes/terrortown/gamemode/vgui/sb_main.lua:235 6. Create - lua/includes/extensions/client/panel/scriptedpanels.lua:153 7. ScoreboardCreate - gamemodes/terrortown/gamemode/cl_scoreboard.lua:27 8. unknown - gamemodes/terrortown/gamemode/cl_scoreboard.lua:34 [ERROR] gamemodes/terrortown/gamemode/vgui/sb_row.lua:222: attempt to index field 'nick' (a nil value) 1. unknown - gamemodes/terrortown/gamemode/vgui/sb_row.lua:222 [ERROR] gamemodes/terrortown/gamemode/vgui/sb_row.lua:222: attempt to index field 'nick' (a nil value) 1. unknown - gamemodes/terrortown/gamemode [/code] Did that and got this as a error.
I'm guessing you haven't updated your scoreboard to the new format and you're using an old one? Where are you placing the actual rank? Because you placed the rank in the score column.
I was given this scoreboard from one of my friends. It had sb_row, sb_main, sb_info, and sb_team files that came with it. My main concern here is just getting rid of it showing "Owner" there, nowhere in my files have I configed it to list specific titles yet. I do not know whats causing it to be there.
Do CTRL+F for usergroup in all three of the files.
This was in sb_row.lua [code]draw.DrawText(ply:GetNWString("usergroup"),"OtherInfo",self:GetWide()/1.32,7,color_white,TEXT_ALIGN_RIGHT)[/code] That's the only file that had it. After removing that line from the code It's gone, but I'm not sure what this "Label" thing is. [img]http://i.imgur.com/XVtOjWm.png[/img] Figured out the fix, Thank you so much for your help. Seriously, have a fantastic rest of your evening.
[QUOTE=SeniorDerp;44512446]This was in sb_row.lua [code]draw.DrawText(ply:GetNWString("usergroup"),"OtherInfo",self:GetWide()/1.32,7,color_white,TEXT_ALIGN_RIGHT)[/code] That's the only file that had it. After removing that line from the code It's gone, but I'm not sure what this "Label" thing is. [img]http://i.imgur.com/XVtOjWm.png[/img][/QUOTE] Scan the code for any empty labels.
Sorry, you need to Log In to post a reply to this thread.