Menan AK47
MENAN AK47DOCS
DiscordStore
Navigation
Menu
Welcome
FAQ
ak47_lib
ak47_target
ak47_ambulancejob
ak47_banking
ak47_business
ak47_carboosting
ak47_cardealer
ak47_clothingshop
ak47_crafting
ak47_crime
ak47_crutch
ak47_deliveryjob
ak47_drugdealerv2
ak47_drugmanagerv3
ak47_drugmissions
ak47_ecommerce
ak47_farming
ak47_fishing
ak47_fraudsystem
ak47_fuelstations
ak47_gangs
ak47_garage
ak47_garbagejob
ak47_hookahloungev2
ak47_housing
ak47_hud
ak47_iclothingv3
ak47_idcardv2
ak47_inventory
ak47_jobgarage
ak47_khusbites
ak47_khusland
ak47_leafnlatte
ak47_mafiasupply
ak47_mechanic
ak47_moneywash
ak47_multicharacter
Exports
Commands
Housing
Clothing
Weather & Time
ak47_npcmed
ak47_outfitbag
ak47_playershop
ak47_policejob
ak47_prospecting
ak47_radio
ak47_rentalcar
ak47_safezone
ak47_sitchair
ak47_smokingv2
ak47_supermarket
ak47_switch
ak47_territories
ak47_vehiclekeys
ak47_vipshop
Loaf
DocsMulti FrameworkWeather & Time

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
end

Resuming 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
end
Previous
Clothing
Next
ak47_npcmed
On this page
Modifying custom/client.luaPausing SynchronizationResuming Synchronization