mirror of
https://github.com/citizenfx/cfx-server-data.git
synced 2025-01-08 06:02:57 +08:00
spawnmanager: fix spawning when faded out, add skipFade option, add timeout for collision loading
This commit is contained in:
parent
23a840f780
commit
64a26ad1de
@ -208,12 +208,6 @@ function spawnPlayer(spawnIdx, cb)
|
||||
spawnLock = true
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
DoScreenFadeOut(500)
|
||||
|
||||
while IsScreenFadingOut() do
|
||||
Citizen.Wait(0)
|
||||
end
|
||||
|
||||
-- if the spawn isn't set, select a random one
|
||||
if not spawnIdx then
|
||||
spawnIdx = GetRandomIntInRange(1, #spawnPoints + 1)
|
||||
@ -228,6 +222,14 @@ function spawnPlayer(spawnIdx, cb)
|
||||
spawn = spawnPoints[spawnIdx]
|
||||
end
|
||||
|
||||
if not spawn.skipFade then
|
||||
DoScreenFadeOut(500)
|
||||
|
||||
while not IsScreenFadedOut() do
|
||||
Citizen.Wait(0)
|
||||
end
|
||||
end
|
||||
|
||||
-- validate the index
|
||||
if not spawn then
|
||||
Citizen.Trace("tried to spawn at an invalid spawn index\n")
|
||||
@ -288,16 +290,20 @@ function spawnPlayer(spawnIdx, cb)
|
||||
--loadScene(spawn.x, spawn.y, spawn.z)
|
||||
--ForceLoadingScreen(false)
|
||||
|
||||
while not HasCollisionLoadedAroundEntity(ped) do
|
||||
local time = GetGameTimer()
|
||||
|
||||
while (not HasCollisionLoadedAroundEntity(ped) and (GetGameTimer() - time) < 5000) do
|
||||
Citizen.Wait(0)
|
||||
end
|
||||
|
||||
ShutdownLoadingScreen()
|
||||
|
||||
DoScreenFadeIn(500)
|
||||
if IsScreenFadedOut() then
|
||||
DoScreenFadeIn(500)
|
||||
|
||||
while IsScreenFadingIn() do
|
||||
Citizen.Wait(0)
|
||||
while not IsScreenFadedIn() do
|
||||
Citizen.Wait(0)
|
||||
end
|
||||
end
|
||||
|
||||
-- and unfreeze the player
|
||||
|
Loading…
Reference in New Issue
Block a user