GetTime

From Multi Theft Auto: Wiki
Revision as of 23:49, 9 November 2016 by N3xT (talk | contribs) (→‎Example)
Jump to navigation Jump to 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

int int getTime ()

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 time = getTime()
    outputChatBox( "The current game time is "..time )
end
addCommandHandler("gettime", currentTime)
Click to collapse [-]
Server
function currentTime(sourcePlayer)
    local time = getTime()
    outputChatBox( "The current game time (server) is "..time, sourcePlayer )
end
addCommandHandler("gettime", currentTime)

See Also