SetTime

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 09:12, 8 August 2026 by QCherry (talk | contribs) (Automatyczna aktualizacja dokumentacji funkcji)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

setTime

Changes the authoritative in-game time for all connected players.

Syntax

bool setTime(int hour, int minute [, int day])

Parameters

Name Type Required Description
hour int yes The hour from 0 to 23.
minute int yes The minute from 0 to 59.
day int no Optional day from 0 to 1000000. The current day is preserved when omitted.

Returns

Returns true when the new time is accepted; otherwise returns false.

Examples

Example 1

Set evening time while preserving the current day:

if not setTime(20, 15) then
    outputDebugString("Could not change world time")
end

Example 2

Set day 4 at sunrise:

setTime(6, 0, 4)

Notes

  • Available only in server-side resource scripts.
  • Accepted changes are broadcast reliably to current players and included in late-join world state.
  • A successful change triggers onTimeChange.