fix(ex_extended): prevent scripts from awaiting when multicharacter is false

This commit is contained in:
RrybaN
2024-09-14 22:10:31 +08:00
parent c80916c3e3
commit 66fa202e66
+11 -2
View File
@@ -25,14 +25,19 @@ function ESX.SpawnPlayer(skin, coords, cb)
end)
Citizen.Await(p)
RequestCollisionAtCoord(coords.x, coords.y, coords.z)
local playerPed = PlayerPedId()
local timer = GetGameTimer()
FreezeEntityPosition(playerPed, true)
SetEntityCoordsNoOffset(playerPed, coords.x, coords.y, coords.z, false, false, false, true)
SetEntityHeading(playerPed, coords.heading)
while not HasCollisionLoadedAroundEntity(playerPed) do
while not HasCollisionLoadedAroundEntity(playerPed) and (GetGameTimer() - timer) < 5000 do
Wait(0)
end
FreezeEntityPosition(playerPed, false)
NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, coords.heading, true, true, false)
TriggerEvent('playerSpawned', coords)
cb()
@@ -203,6 +208,10 @@ AddEventHandler("esx:playerLoaded", function(xPlayer, _, skin)
end
end
if not Config.Multichar then
FreezeEntityPosition(ESX.PlayerData.ped, false)
end
if IsScreenFadedOut() then
DoScreenFadeIn(500)
end