1
0
Fork 0
forked from Simnation/Main
Main/resources/[Developer]/[Mark]/av_weather/client/editable/spawn.lua
2025-06-07 08:51:21 +02:00

50 lines
No EOL
1.3 KiB
Lua

if not Config.Framework then
CreateThread(function()
while true do
if NetworkIsSessionStarted() then
init()
return
end
Wait(0)
end
end)
end
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
Wait(2000)
init()
TriggerEvent('av_weather:freeze', false)
end)
RegisterNetEvent('esx:playerLoaded', function()
Wait(2000)
init()
TriggerEvent('av_weather:freeze', false)
end)
AddEventHandler('onResourceStart', function(resourceName)
if (GetCurrentResourceName() ~= resourceName) then
return
end
init()
end)
RegisterCommand("weather:sync", function()
print("syncying player with server...")
if Config.UseFog then
initFog()
end
print("Player Frozen State? ", LocalPlayer.state and LocalPlayer.state.frozen)
print("ready?", ready)
print("playerLoaded?", ready)
print("pauseSync?", pauseSync)
print("pauseTime?", pauseTime)
calculateSpeed(Config.TimeCycleDuration)
LocalPlayer.state:set("frozen", false, false)
ready = true
playerLoaded = true
pauseSync = false
pauseTime = false
TriggerServerEvent("av_weather:freeze", false)
print("Player should be now synced.")
end)