mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-30 01:38:52 +00:00
Fix new player error on first spawn
This commit is contained in:
+2
-4
@@ -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)
|
||||
|
||||
|
||||
+2
-2
@@ -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` (
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user