GetGameType: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
Line 28: Line 28:
<!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc -->
<!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc -->
{{ASE functions}}
{{ASE functions}}
[[Category:Needs_Example]] <!-- leave this until the example is completed. -->

Revision as of 19:51, 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 )

See Also

Template:ASE functions