diff --git a/client/main.lua b/client/main.lua index a899bced..74dd7f76 100644 --- a/client/main.lua +++ b/client/main.lua @@ -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) diff --git a/es_extended.sql b/es_extended.sql index 0b51e267..6ea1ce6f 100644 --- a/es_extended.sql +++ b/es_extended.sql @@ -1,12 +1,12 @@ USE `essentialmode`; ALTER TABLE `users` - ADD COLUMN `name` VARCHAR(255) NULL DEFAULT '' AFTER `money`, + ADD COLUMN `name` VARCHAR(50) NULL DEFAULT '' AFTER `money`, ADD COLUMN `skin` LONGTEXT NULL AFTER `name`, ADD COLUMN `job` varchar(50) NULL DEFAULT 'unemployed' AFTER `skin`, ADD COLUMN `job_grade` INT NULL DEFAULT 0 AFTER `job`, ADD COLUMN `loadout` LONGTEXT NULL AFTER `job_grade`, - ADD COLUMN `position` VARCHAR(50) NULL AFTER `loadout` + ADD COLUMN `position` VARCHAR(36) NULL AFTER `loadout` ; CREATE TABLE `items` ( diff --git a/server/classes/player.lua b/server/classes/player.lua index 32e4ac74..1ced96d6 100644 --- a/server/classes/player.lua +++ b/server/classes/player.lua @@ -199,9 +199,11 @@ function CreateExtendedPlayer(player, accounts, inventory, job, loadout, name, l end self.getLastPosition = function() - self.lastPosition.x = ESX.Math.Round(self.lastPosition.x, 2) - self.lastPosition.y = ESX.Math.Round(self.lastPosition.y, 2) - self.lastPosition.z = ESX.Math.Round(self.lastPosition.z, 2) + if self.lastPosition then + self.lastPosition.x = ESX.Math.Round(self.lastPosition.x, 1) + self.lastPosition.y = ESX.Math.Round(self.lastPosition.y, 1) + self.lastPosition.z = ESX.Math.Round(self.lastPosition.z, 1) + end return self.lastPosition end