Merge pull request #1396 from RrybaN/fix-awaiting-scripts

fix(ex_extended): prevent scripts from awaiting when multicharacter is false
This commit is contained in:
Gellipapa
2024-09-15 15:06:57 +02:00
committed by GitHub
+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