Gamemode.ShowGamemodeChooser

From GMod Wiki

Jump to: navigation, search
Event Hook
Hook NameShowGamemodeChooser
SyntaxGM:ShowGamemodeChooser( )
DescriptionDraws the Gamemode Chooser to the client's screen.
ReturnsNil
Lua StateNewerClient.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.ShowGamemodeChooser]Gamemode.ShowGamemodeChooser [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionSource Code
Used onNewerClient.png
Code
 
local ClassChooser = nil 
function GM:ShowGamemodeChooser()
 
	if ( !g_bGotGamemodesTable ) then
		timer.Simple( 0.1, self.ShowGamemodeChooser, self )
		return
	end
 
	if ( !IsValid( GMChooser ) ) then 
 
		GMChooser = vgui.CreateFromTable( vgui_Splash )
		GMChooser:SetHeaderText( "What do you want to play?" )
		GMChooser:SetHoverText( "" );
 
		for _, v in SortedPairsByMemberValue( g_PlayableGamemodes, "name" ) do
 
			local func = function() GAMEMODE:ShowMapChooser( v ) end
			local btn = GMChooser:AddSelectButton( v.label, func, v.description )
			btn.m_colBackground = Color( 50, 180, 255 )
 
		end
 
		GMChooser:AddCancelButton()
 
	end
 
	GMChooser:MakePopup()
	GMChooser:NoFadeIn()
 
end
OutputDraws the GM Chooser and it's options to the screen.
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox