Esc to clear, Enter to open the best match, click an export to open it in its page
World

Time & Weather

The server keeps one clock and one weather for everyone, and every player's game follows it. Layers show one player something else: night in a club, fog in a zone, a storm during a mission.

The world's clock and weather

Read and set them from the server with the Time & Weather API: local h, m = exports.whip_core:GetTime(). Time, weather, freeze, blackout and time scale are saved, so a restart picks up where it left off; a new server starts from Config.StartTime.

-- config.lua
Config.TimeScale    = 1.0     -- 1.0 = normal GTA speed (48 min real = 24 h game)
Config.StartTime    = { hour = 12, minute = 0 }
Config.StartWeather = 'CLEAR'
Config.WeatherTypes = { 'CLEAR', 'EXTRASUNNY', 'CLOUDS', 'OVERCAST', 'RAIN', 'CLEARING', 'THUNDER',
    'SMOG', 'FOGGY', 'XMAS', 'SNOWLIGHT', 'BLIZZARD', 'HALLOWEEN', 'NEUTRAL' }

One player's sky: layers#

A layer is a named change to what one player sees, and layers stack. Each field comes from the highest-priority layer that sets it (ties break by name), or else the server. Each source clears only its own layer, so what was under it comes back; yours come off when your resource stops.

FieldTypeMeaning
prioritynumberHigher wins. Default 0
weatherstringA name from Config.WeatherTypes
hour, minutenumberWhere the clock starts; it runs unless frozen
frozenbooleanHolds the clock
blackoutbooleanTurns off the city lights
-- Server: 1am and clear skies inside the club, clock held still
exports.whip_core:SetPlayerWeatherLayer(source, 'nightclub', {
    hour = 1, minute = 0, weather = 'CLEAR', frozen = true, priority = 50,
})
exports.whip_core:ClearPlayerWeatherLayer(source, 'nightclub')

-- Client: no round trip needed, a layer only affects this machine
exports.whip_core:SetWeatherLayer('zone:swamp', { weather = 'FOGGY', priority = 10 })

A zone with a weather field (a weather name, or a layer table such as { weather = 'FOGGY', hour = 3 }) pushes a layer named after itself on enter and pops it on exit; the layer's priority defaults to a little above the zone's own.

frozen = false isn't the same as leaving it out. Left out, it comes from the layer below; false un-freezes a lower layer's clock. blackout works the same. Don't build layers with x and y or nil, which turns false into "no opinion".

Changing it in gameServer owners#

/whip → World → Time & Weather sets the time (or Dawn, Noon, Sunset, Midnight), the weather, freeze, blackout and time scale (0 to 10). Changes apply to the whole server at once.