diff --git a/[esx]/es_extended/client/main.lua b/[esx]/es_extended/client/main.lua index 438a1b5f..9e0144ce 100644 --- a/[esx]/es_extended/client/main.lua +++ b/[esx]/es_extended/client/main.lua @@ -454,9 +454,7 @@ function StartServerSyncLoops() if distance > 1 then previousCoords = playerCoords - local playerHeading = ESX.Math.Round(GetEntityHeading(ESX.PlayerData.ped), 1) - local formattedCoords = {x = ESX.Math.Round(playerCoords.x, 1), y = ESX.Math.Round(playerCoords.y, 1), z = ESX.Math.Round(playerCoords.z, 1), heading = playerHeading} - TriggerServerEvent('esx:updateCoords', formattedCoords) + TriggerServerEvent('esx:updateCoords') end end Wait(1500) diff --git a/[esx]/es_extended/server/classes/player.lua b/[esx]/es_extended/server/classes/player.lua index da1e5ed3..c1a16652 100644 --- a/[esx]/es_extended/server/classes/player.lua +++ b/[esx]/es_extended/server/classes/player.lua @@ -33,7 +33,9 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, SetEntityHeading(Ped, vector.w) end - function self.updateCoords(coords) + function self.updateCoords() + local Ped = GetPlayerPed(self.source) + local coords = GetEntityCoords(Ped) self.coords = {x = ESX.Math.Round(coords.x, 1), y = ESX.Math.Round(coords.y, 1), z = ESX.Math.Round(coords.z, 1), heading = ESX.Math.Round(coords.heading or 0.0, 1)} end diff --git a/[esx]/es_extended/server/main.lua b/[esx]/es_extended/server/main.lua index 3a9e5f6d..28d88891 100644 --- a/[esx]/es_extended/server/main.lua +++ b/[esx]/es_extended/server/main.lua @@ -380,11 +380,12 @@ AddEventHandler('esx:playerLogout', function(playerId, cb) end) RegisterNetEvent('esx:updateCoords') -AddEventHandler('esx:updateCoords', function(coords) +AddEventHandler('esx:updateCoords', function() + local source = source local xPlayer = ESX.GetPlayerFromId(source) if xPlayer then - xPlayer.updateCoords(coords) + xPlayer.updateCoords() end end)