Fix new player error on first spawn

This commit is contained in:
ElPumpo
2018-12-31 14:11:05 +01:00
parent dc44b7c667
commit 22a4d67971
3 changed files with 9 additions and 9 deletions
+2 -4
View File
@@ -568,18 +568,16 @@ end)
-- Last position
Citizen.CreateThread(function()
while true do
Citizen.Wait(1000)
if ESX ~= nil and ESX.PlayerLoaded and PlayerSpawned then
if ESX.PlayerLoaded and PlayerSpawned then
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
if not IsEntityDead(playerPed) then
ESX.PlayerData.lastPosition = {x = ESX.Math.Round(coords.x, 2), y = ESX.Math.Round(coords.y, 2), z = ESX.Math.Round(coords.z, 2)}
ESX.PlayerData.lastPosition = {x = coords.x, y = coords.y, z = coords.z}
end
end
end
end)