• add mute button to fretta scoreboard
    7 replies, posted
hello, so im trying to add a mute button to the fretta scoreboard. I know where it goes in the cl_scores.lua file but im not sure how the function to it. this is what i got so far: [lua] function GM:AddScoreboardKills( ScoreBoard ) local f = function( ply ) return ply:Frags() end ScoreBoard:AddColumn( "Kills", 50, f, 0.5, nil, 6, 6 ) end function GM:AddScoreboardDeaths( ScoreBoard ) local f = function( ply ) return ply:Deaths() end ScoreBoard:AddColumn( "Deaths", 50, f, 0.5, nil, 6, 6 ) end function GM:AddScoreboardPing( ScoreBoard ) local f = function( ply ) return ply:Ping() end ScoreBoard:AddColumn( "Ping", 50, f, 0.1, nil, 6, 6 ) end function GM:AddScoreboardMute( ScoreBoard ) local f = function( ply ) return ply:SetMuted() end ScoreBoard:AddColumn( "Mute", 50, f, 0.1, nil, 6, 6 ) end [/lua] heres a screenshot: [url]http://i.imgur.com/E1JL5Uc.png[/url] can anyone help me out with this?
I've looked at that scoreboard before and it's probably not doing anything because it just displays stuff, there's no indication to mute the player when you click it You could see about turning it into a DButton
[QUOTE=NiandraLades;47417989]I've looked at that scoreboard before and it's probably not doing anything because it just displays stuff, there's no indication to mute the player when you click it You could see about turning it into a DButton[/QUOTE] ive seen on other ph servers that they have the mute button in the fretta scoreboard. how could i turn it into a dbutton?
[QUOTE=jobforacowboy;47417998]ive seen on other ph servers that they have the mute button in the fretta scoreboard. how could i turn it into a dbutton?[/QUOTE] And they probably did what NirandraLades suggested. The scoreboard only displays the value returned by function f.
[QUOTE=James xX;47418006]And they probably did what NirandraLades suggested. The scoreboard only displays the value returned by function f.[/QUOTE] alright so should i use something like this? [url]http://wiki.garrysmod.com/page/Category:DPanel[/url]
[QUOTE=jobforacowboy;47418016]alright so should i use something like this? [url]http://wiki.garrysmod.com/page/Category:DPanel[/url][/QUOTE] More like this [url]http://wiki.garrysmod.com/page/Category:DButton[/url]
cool thanx guys for your help i give that a try
Before you try and just add it the same way again, please note, the AddColumn function is for adding text that is updated every so often. To add a DButton that way would probably break things. Instead, you will have to edit some of the scoreboard base code ( Create a function to add derma objects as a column, change the think functions on the scoreboard and the scoreboard_team objects so they don't try and update the text which isn't there, and also make sure the object is deleted when the scoreboard_team is deleted. )
Sorry, you need to Log In to post a reply to this thread.