Derma and ConCommand - Questions

Hello, three things here, answers to any of them will be appreciated.

  1. I have been creating a Derma menu with collapsible categories which have check boxes inside, I am trying to find out if there is a way where the player can only have 1 check box selected at a time, hope someone can help.

  2. Is there a way to only allow access to a Derma menu when the player is dead/respawning, and to display a message/notification if the player tries to access it when they are alive?

  3. Is there any way to bind a console command to a players key when they are in the game? E.g. bind F1 to console command team_menu.

Derma Collapsible code (cl_init.lua)

[lua]local DermaPanel = vgui.Create( “DFrame” )
DermaPanel:SetPos( 50,50 )
DermaPanel:SetSize( 250, 300 )
DermaPanel:SetTitle( “Pause Menu” )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( false )
DermaPanel:ShowCloseButton( true )
DermaPanel:MakePopup()

local SomeCollapsibleCategory = vgui.Create(“DCollapsibleCategory”, DermaPanel)
SomeCollapsibleCategory:SetPos( 25,50 )
SomeCollapsibleCategory:SetSize( 200, 50 ) – Keep the second number at 50
SomeCollapsibleCategory:SetExpanded( 0 ) – Expanded when popped up
SomeCollapsibleCategory:SetLabel( “Team Select” )

CategoryList = vgui.Create( “DPanelList” )
CategoryList:SetAutoSize( true )
CategoryList:SetSpacing( 5 )
CategoryList:EnableHorizontal( false )
CategoryList:EnableVerticalScrollbar( true )

SomeCollapsibleCategory:SetContents( CategoryList ) – Add our list above us as the contents of the collapsible category

local CategoryContentOne = vgui.Create( "DCheckBoxLabel" )
CategoryContentOne:SetText( "Russia" )
CategoryContentOne:SetConVar( "team_russia" )
CategoryContentOne:SetValue( 1 )
CategoryContentOne:SizeToContents()

CategoryList:AddItem( CategoryContentOne ) – Add the above item to our list

local CategoryContentTwo = vgui.Create( "DCheckBoxLabel" )
CategoryContentTwo:SetText( "USA" )
CategoryContentTwo:SetConVar( "team_usa" )
CategoryContentTwo:SetValue( 1 )
CategoryContentTwo:SizeToContents()

CategoryList:AddItem( CategoryContentTwo )[/lua]

Don’t
Let clients bind it themselves

For biding to F1, network the panel to thr GM:ShowHelp() hook.

To have one check box at a time, you can do some of statements to see if other checkboxes are checked, and if so, uncheck it.

If you want to see if the player is alive, you can add an if statement for if the LocalPlaye is alive or not.

I’ve always wondered, is it worth even doing the checks? Why not just set them all to unchecked?