SetGameType: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
mNo edit summary
 
(13 intermediate revisions by 7 users not shown)
Line 1: Line 1:
[[Category:Incomplete]]
__NOTOC__
[[Category:Need Syntax]]
{{Server function}}
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.


__NOTOC__
'''It should be noted that [[mapmanager]] handles this automatically for gamemodes that utilise the map/gamemode system.'''
This function is for blahblah.. not defined yet


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
INSERT SYNTAX HERE             
bool setGameType ( string gameType )
</syntaxhighlight>  
</syntaxhighlight>  
 
[[File:GameType.png|thumb|Gamemode column that shows a server's game type.]]
===Required Arguments===  
===Required Arguments===  
*'''argumentName:''' description
*'''gameType:''' A string containing a name for the game mode, or ''false'' to clear it.
 
===Optional Arguments===
{{OptionalArg}}
*'''argumentName2:''' descriptiona
*'''argumentName3:''' description


===Returns===
===Returns===
Returns ''true'' if blah, ''false'' otherwise.
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''.
<syntaxhighlight lang="lua">
setGameType ( "Capture The Flag" )
</syntaxhighlight>


==Example==  
==Example 2==  
This example does...
This example adds a command to change the game type.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
function setNewGameType( source, commandName, newGameType )
blabhalbalhb --abababa
    local oldGameType = getGameType() -- check old Game Type
--This line does this...
    setGameType( newGameType ) -- set new Game Type
mooo
    outputChatBox( "Game Type " .. oldGameType .. " changed to " .. newGameType .. ".", getRootElement(), 255, 128, 0 )
end
addCommandHandler( "setgametype", setNewGameType )
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{FunctionArea_Functions}}
{{Announce functions}}

Latest revision as of 14:18, 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 )
Gamemode column that shows a server's game type.

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