diff --git a/[core]/es_extended/client/main.lua b/[core]/es_extended/client/main.lua index 27180dd7..4e79830b 100644 --- a/[core]/es_extended/client/main.lua +++ b/[core]/es_extended/client/main.lua @@ -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