mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 08:13:21 +00:00
don't save player when not spawned
This commit is contained in:
@@ -14,6 +14,11 @@ Core.playersByIdentifier = {}
|
||||
|
||||
Core.vehicleTypesByModel = {}
|
||||
|
||||
|
||||
RegisterNetEvent('esx:onPlayerSpawn', function()
|
||||
ESX.Players[source].spawned = true
|
||||
end)
|
||||
|
||||
AddEventHandler("esx:getSharedObject", function()
|
||||
local Invoke = GetInvokingResource()
|
||||
print(("[^1ERROR^7] Resource ^5%s^7 Used the ^5getSharedObject^7 Event, this event ^1no longer exists!^7 Visit https://documentation.esx-framework.org/tutorials/tutorials-esx/sharedevent for how to fix!"):format(Invoke))
|
||||
|
||||
@@ -171,6 +171,10 @@ local function updateHealthAndArmorInMetadata(xPlayer)
|
||||
end
|
||||
|
||||
function Core.SavePlayer(xPlayer, cb)
|
||||
if not xPlayer.spawned then
|
||||
return cb and cb()
|
||||
end
|
||||
|
||||
updateHealthAndArmorInMetadata(xPlayer)
|
||||
local parameters <const> = {
|
||||
json.encode(xPlayer.getAccounts(true)),
|
||||
|
||||
Reference in New Issue
Block a user