Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- hook.Add("TTTSettingsTabs", "ScoreboardColorMenu", function(dtabs)
- local padding = dtabs:GetPadding()
- padding = padding * 2
- local dsettings = vgui.Create("DPanelList", dtabs)
- dsettings:StretchToParent(0,0,padding,0)
- dsettings:EnableVerticalScrollbar(true)
- dsettings:SetPadding(10)
- dsettings:SetSpacing(10)
- do
- -- My Sliders
- local Red = vgui.Create( "DNumSlider" ) --Red
- Red:SetText( "Red" )
- Red:SetTooltip( "The RED value of your color" )
- Red:SetMin( 1 )
- Red:SetMax( 256 )
- Red:SetDecimals( 0 )
- dsettings:AddItem( Red )
- local Green = vgui.Create( "DNumSlider" ) --Green
- Green:SetText( "Green" )
- Green:SetTooltip( "The GREEN value of your color" )
- Green:SetMin( 1 )
- Green:SetMax( 256 )
- Green:SetDecimals( 0 )
- dsettings:AddItem( Green )
- local Blue = vgui.Create( "DNumSlider" ) --Blue
- Blue:SetText( "Blue" )
- Blue:SetTooltip( "The BLUE value of your color" )
- Blue:SetMin( 1 )
- Blue:SetMax( 256 )
- Blue:SetDecimals( 0 )
- dsettings:AddItem( Blue )
- -- Check box
- local Activate = vgui.Create( "DCheckBoxLabel" )
- Activate:SetParent( dsettings )
- Activate:SetPos( 25, 200 )
- Activate:SetText( "Have Colored Name" )
- Activate:SetTooltip( "Enable/Disable having a colored scoreboard name" )
- Activate:SetConVar( "" )
- Activate:SetValue( 0 )
- Activate:SizeToContents()
- local submit = vgui.Create("Button", self)
- submit:SetText("Submit")
- submit:SetTooltip( "Change the color of your scoreboard name. Takes effect on the next map" )
- submit:SetParent( dsettings )
- submit:SetSize( 150,30 )
- submit:SetPos( 25, 250 )
- -- 220 is a good horizontal middle
- submit:SetVisible( true )
- function submit:OnMousePressed()
- -- Retrieve and round all the values that were previously selected
- redslide = Red:GetValue()
- redslide = math.Round(redslide)
- greenslide = Green:GetValue()
- greenslide = math.Round(greenslide)
- blueslide = Blue:GetValue()
- blueslide = math.Round(blueslide)
- -- Put the values into Convars
- CreateClientConVar( "ttt_color_red", redslide, true, true )
- CreateClientConVar( "ttt_color_green", greenslide, true, true )
- CreateClientConVar( "ttt_color_blue", blueslide, true, true )
- CreateClientConVar( "ttt_iscolored", "1", true, true )
- -- Makes them into strings to be used in the console command
- redslide = tostring(redslide)
- greenslide = tostring(greenslide)
- blueslide = tostring(blueslide)
- RunConsoleCommand( "ttt_color_red", redslide )
- RunConsoleCommand( "ttt_color_green", greenslide )
- RunConsoleCommand( "ttt_color_blue", blueslide )
- print(redslide, greenslide, blueslide)
- end
- end
- -- Adds the menu
- dtabs:AddSheet("Name Color", dsettings, "icon16/table_gear.png", false, false, "Scoreboard Name Color Settings")
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement