Gamemode.ShowMapChooser

From GMod Wiki

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


Examples

DescriptionSource Code
Used onNewerClient.png
Code
local MapChooser = nil 
function GM:ShowMapChooser( gm_table )
 
	if ( MapChooser ) then MapChooser:Remove() end
 
	MapChooser = vgui.CreateFromTable( vgui_Splash )
	MapChooser:SetHeaderText( "Which Map?" )
	MapChooser:SetHoverText( "Which of these maps do you want to play this gamemode on?" );
 
	for _, v in SortedPairs( gm_table.maps ) do
 
		local func = function() RunConsoleCommand( "playgamemode", gm_table.name, v ) end
		local btn = MapChooser:AddSelectButton( v, func )
		btn.m_colBackground = Color( 120, 255, 100 )
 
	end
 
	MapChooser:AddCancelButton()
	MapChooser:MakePopup()
	MapChooser:NoFadeIn()
 
end
OutputDraws the Map Chooser and it's options to the screen.
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox