SetGameType: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 20: | Line 20: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
setGameType ( "Capture The Flag" ) | setGameType ( "Capture The Flag" ) | ||
</syntaxhighlight> | |||
==Example 2== | |||
This example add command to change Game Type. | |||
<syntaxhighlight lang="lua"> | |||
function setGameType( source, commandName, newGameType ) | |||
local oldGameType = GetGameType() -- check old Game Type | |||
setGameType( newGameType ) -- set new Game Type | |||
outputchatBox( "Game Type " .. oldGameType .. " changed to " .. newGameType .. ".", getRootElement(), 255, 128, 0 ) | |||
addCommandHandler( "setgametype", setGameType ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Announce functions}} | {{Announce functions}} |
Revision as of 16:05, 17 March 2010
This function sets a string containing a name for the game type. This should be the game-mode that is active, for example "Capture The Flag" or "Deathmatch". This is then displayed in the server browser and external server browsers.
It should be noted that mapmanager handles this automatically for gamemodes that utilise the map/gamemode system.
Syntax
bool setGameType ( string gameType )
Required Arguments
- gameType: A string containing a name for the game mode, or false to clear it.
Returns
Returns true if the game type was set, false if an invalid argument was passed to the function.
Example
This example sets the game type to Capture The Flag.
setGameType ( "Capture The Flag" )
Example 2
This example add command to change Game Type.
function setGameType( source, commandName, newGameType ) local oldGameType = GetGameType() -- check old Game Type setGameType( newGameType ) -- set new Game Type outputchatBox( "Game Type " .. oldGameType .. " changed to " .. newGameType .. ".", getRootElement(), 255, 128, 0 ) addCommandHandler( "setgametype", setGameType )
See Also