GetGameType: Difference between revisions
Jump to navigation
Jump to search
m (→Example) |
|||
Line 19: | Line 19: | ||
function playerJoinHandler( ) | function playerJoinHandler( ) | ||
if getGameType() == "Race" then | if getGameType() == "Race" then | ||
outputChatBox( "Ready... Get set... GO!!" ) | outputChatBox( "Ready... Get set... GO!!", source ) | ||
end | end | ||
end | end |
Revision as of 19:40, 2 April 2008
This function retrieves the current gametype as set by setGameType.
Syntax
string getGameType ()
Returns
Returns the gametype as a string. If no gametype is set it returns nil.
Example
This example sends a message to player when he joins, if the current game type is Race.
function playerJoinHandler( ) if getGameType() == "Race" then outputChatBox( "Ready... Get set... GO!!", source ) end end addEventHandler( "onPlayerJoin", getRootElement(), playerJoinHandler )