GetGameType: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
Line 27: Line 27:
==See Also==
==See Also==
<!-- 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}}
{{Announce functions}}

Latest revision as of 16:18, 30 January 2009

This function retrieves the current gametype as set by setGameType. The game type is displayed in the server browser next to the server's name.

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