getGameType | Multi Theft Auto: Wiki Skip to content

getGameType

Client-side
Server-side
Shared

Pair: setGameType

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|nil getGameType ( )

Returns

  • string|nil: game type (gamemode)

Returns the gametype as a string. If no gametype is set it returns nil.

Code Examples

server

This example sends a message to player when he joins, if the current game type is Race.

local function playerJoinHandler()
if (getGameType() == "Race") then
outputChatBox("Ready... Get set... GO!!", source)
end
end
addEventHandler("onPlayerJoin", root, playerJoinHandler)