Weather & Time
Time and weather synchronization handling during character selection.
Freezes weather and time during character selection to prevent visual flickering. Natively supports cd_easytime and qb-weathersync.
Modifying custom/client.lua
Configure pause and resume functions in custom/client.lua.
Pausing Synchronization
Pauses server weather sync and forces clear weather during character selection.
function Custom_StartTimeLoop()
if not timeLoop then
timeLoop = true
if GetResourceState('cd_easytime') == 'started' then
TriggerEvent('cd_easytime:PauseSync', true, 1)
else
if GetResourceState('qb-weathersync') == 'started' then
TriggerEvent('qb-weathersync:client:DisableSync')
end
CreateThread(function()
while timeLoop do
Wait(1)
NetworkOverrideClockTime(1, 0, 0)
ClearOverrideWeather()
ClearWeatherTypePersist()
SetWeatherTypePersist('CLEAR')
SetWeatherTypeNow('CLEAR')
SetWeatherTypeNowPersist('CLEAR')
end
end)
end
end
endResuming Synchronization
Resumes server weather and time sync when the player enters the world.
function Custom_StopTimeLoop()
if timeLoop then
timeLoop = false
TriggerEvent('qb-weathersync:client:EnableSync')
TriggerEvent('cd_easytime:PauseSync', false)
end
endOn this page