diff --git a/[core]/es_extended/client/modules/actions.lua b/[core]/es_extended/client/modules/actions.lua index 0ff99ff9..98b864b1 100644 --- a/[core]/es_extended/client/modules/actions.lua +++ b/[core]/es_extended/client/modules/actions.lua @@ -45,7 +45,6 @@ function Actions:TrackPed() local newPed = PlayerPedId() if playerPed ~= newPed then - ESX.PlayerData.ped = newPed ESX.SetPlayerData("ped", newPed) TriggerEvent("esx:playerPedChanged", newPed) diff --git a/[core]/es_extended/client/modules/death.lua b/[core]/es_extended/client/modules/death.lua index ab75719c..ba3fb846 100644 --- a/[core]/es_extended/client/modules/death.lua +++ b/[core]/es_extended/client/modules/death.lua @@ -63,7 +63,7 @@ end AddEventHandler("esx:onPlayerSpawn", function() Citizen.CreateThreadNow(function() while ESX.PlayerLoaded and not ESX.PlayerData.dead do - if IsPedDeadOrDying(ESX.PlayerData.ped, true) or IsPedFatallyInjured(ESX.PlayerData.ped) then + if DoesEntityExist(ESX.PlayerData.ped) and (IsPedDeadOrDying(ESX.PlayerData.ped, true) or IsPedFatallyInjured(ESX.PlayerData.ped)) then Death:Died() break end diff --git a/[core]/es_extended/imports.lua b/[core]/es_extended/imports.lua index d6eb1449..2727995d 100644 --- a/[core]/es_extended/imports.lua +++ b/[core]/es_extended/imports.lua @@ -14,6 +14,7 @@ if not IsDuplicityVersion() then -- Only register this event for the client RegisterNetEvent("esx:playerLoaded", function(xPlayer) ESX.PlayerData = xPlayer + while not ESX.PlayerData.ped or not DoesEntityExist(ESX.PlayerData.ped) do Wait(0) end ESX.PlayerLoaded = true end)