SetGameType: Difference between revisions
Jump to navigation
Jump to search
^iiEcoo'x ) (talk | contribs) No edit summary |
^iiEcoo'x ) (talk | contribs) No edit summary |
||
Line 9: | Line 9: | ||
bool setGameType ( string gameType ) | bool setGameType ( string gameType ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
[[File:GameType.png|thumb|exmaple]] | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''gameType:''' A string containing a name for the game mode, or ''false'' to clear it. | *'''gameType:''' A string containing a name for the game mode, or ''false'' to clear it. | ||
Line 15: | Line 15: | ||
===Returns=== | ===Returns=== | ||
Returns ''true'' if the game type was set, ''false'' if an invalid argument was passed to the function. | Returns ''true'' if the game type was set, ''false'' if an invalid argument was passed to the function. | ||
==Example== | ==Example== | ||
This example sets the game type to ''Capture The Flag''. | This example sets the game type to ''Capture The Flag''. |
Revision as of 13:16, 27 April 2020
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 adds a command to change the game type.
function setNewGameType( 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 ) end addCommandHandler( "setgametype", setNewGameType )
See Also