GetTime

From Multi Theft Auto: Wiki

Jump to: navigation, search

This function is used to get the current time in the game. If you want to get the real server time, use getRealTime.

Syntax

Returns

Returns two ints that represent hours and minutes.

Example

These two examples adds the command gettime which outputs the local game time and the server game time.

Click to collapse [-]
Client

function currentTime()
    local hour, minutes = getTime()
    outputChatBox( "The current game time is "..hour..":"..minutes )
end
addCommandHandler("gettime", currentTime)
Click to collapse [-]
Server

function currentTime(sourcePlayer)
    local hour, minutes = getTime()
    outputChatBox( "The current game time (server) is "..hour..":"..minutes, sourcePlayer )
end
addCommandHandler("gettime", currentTime)

See Also

In other languages