Scripts/resources/[renewed]/Renewed-Weathersync/compatability/cd/client.lua

29 lines
691 B
Lua
Raw Normal View History

2024-12-30 10:15:34 +00:00
if GetConvar('weather_disablecd', 'false') == 'true' then
return
end
local cd_weather = {}
local playerState = LocalPlayer.state
AddStateBagChangeHandler('weather', 'global', function(_, _, value)
if value then
cd_weather.weather = value.weather
end
end)
AddStateBagChangeHandler('blackOut', 'global', function(_, _, value)
cd_weather.blackout = value
end)
AddStateBagChangeHandler('freezeTime', 'global', function(_, _, value)
cd_weather.freeze = value
end)
AddEventHandler('__cfx_export_cd_easytime_GetWeather', function()
return cd_weather
end)
RegisterNetEvent('cd_easytime:PauseSync', function(toggle)
playerState.syncWeather = not toggle
end)