Exports

Server and client exports of ak47_timesync, plus the exports and events of other resources that it provides automatically.

Server

-- Time. Returns { hours, mins, seconds, hour, minute }
local time = exports['ak47_timesync']:GetTime()
exports['ak47_timesync']:SetTime(12, 0, 0, 5, false) -- hours, mins, seconds, transitionSpeedSec, instantSnap

-- Timescale, milliseconds per game minute
local ms = exports['ak47_timesync']:GetMinuteDuration()
exports['ak47_timesync']:SetMinuteDuration(60000)

-- Weather
local weather = exports['ak47_timesync']:GetWeather()
exports['ak47_timesync']:SetWeather('RAIN', 10, false) -- weather, durationSeconds, instant
local nextWeather = exports['ak47_timesync']:GetNextWeather()
exports['ak47_timesync']:NextWeatherStage()

-- Environment
exports['ak47_timesync']:SetBlackout(true)
exports['ak47_timesync']:SetFreezeTime(true)
exports['ak47_timesync']:SetFreezeWeather(true)
exports['ak47_timesync']:SetDynamicWeather(true)
exports['ak47_timesync']:SetSnowTracks(true)
exports['ak47_timesync']:SetRainLevel(0.8) -- -1.0 is automatic

-- Zone weather
exports['ak47_timesync']:SetZoneWeatherEnabled(true)
exports['ak47_timesync']:SetZoneWeather('DESERT', 'THUNDER', 10, false)
local zones = exports['ak47_timesync']:GetAllZoneWeathers()

-- Full snapshot
local state = exports['ak47_timesync']:GetFullState()

Client

local time = exports['ak47_timesync']:GetTime()
local minuteDuration = exports['ak47_timesync']:GetMinuteDuration()
local weather = exports['ak47_timesync']:GetWeather()
local isBlackout = exports['ak47_timesync']:GetBlackout()
local rainLevel = exports['ak47_timesync']:GetRainLevel()

-- Zone weather
local isZoneMode = exports['ak47_timesync']:IsZoneWeatherEnabled()
local zoneId, zoneLabel = exports['ak47_timesync']:GetCurrentZone()
local isInsideChiliad, tier = exports['ak47_timesync']:IsInsideChiliad()

-- Pause sync locally, for clothing stores, cutscenes, and similar
exports['ak47_timesync']:SetPauseSync(true, 20) -- pauses and sets the client hour to 20:00
exports['ak47_timesync']:SetPauseSync(false)    -- resumes server sync
local isPaused = exports['ak47_timesync']:IsSyncPaused()

Compatibility

These exports and net events of other resources are provided automatically:

  • qb-weathersync / qbx_weathersync: getWeatherState, getTimeState, getBlackoutState, getTimeFreezeState, setWeather, setTime, setBlackout, setTimeFreeze, and others.
  • cd_easytime: GetWeather, GetTime, GetPauseSyncState, SetPauseSync, TogglePauseSync, GetAllData, GetRealData, and others.
  • vSync / vSyncR: getWeather, getTime, updateWeather, updateTime, toggle, and others.
  • esx_weather: ToggleWeatherSync, ToggleTimeSync, esx_weather:server:setZoneWeather, esx_weather:client:time:setTime, and others.