This is how you can run a cg_draw2d command for example -
BUTTON( 6, 176, WINDOW_WIDTH-12, 18, "DISABLE DRAW2D", .3, 14, close ingame_main ; open your_menu_def; exec "cg_draw2d 0" )
Should work with every command.
And for opening console you also need to use command, such as pressing “~”, what actually is a bind of “toggleconsole” command.
So theoretically for opening console, this is what it should look like:
BUTTON( 6, 176, WINDOW_WIDTH-12, 18, "OPEN CONSOLE", .3, 14, close ingame_main; exec "toggleconsole" )
I guess you’re using Silent mod, and want to show stats for others, well I guess it should look like this -
BUTTON( 6, 176, WINDOW_WIDTH-12, 18, "STATS", .3, 14, close ingame_main ; exec "say !stats; toggleconsole" )
Note/!\ - These code snippets are not tested, yet! 