ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. setTime

Function

setTime

Server and clientWorldIdentical to MTA:SA

Sets the in-game time for every player. From then on the clock keeps running by itself (unless it is stopped with setTimeFrozen); one game minute lasts one second by default (setMinuteDuration). The time of day changes the lighting, the sky colour and whether it is dark.

Syntax

bool setTime(int hour [, int minute = 0])

Arguments

hourint
Hour 0-23.
minuteint, optional = 0
Minute 0-59.

Returns

true on success.

Example

addCommandHandler("noc", function()
    setTime(0, 0)
end)

Notes

Client. setTime in a client script changes the time for this player only (e.g. each arena with its own time of day); the clock keeps the server's pace, and the local time holds until the server itself calls setTime.

See also