don't save player when not spawned

This commit is contained in:
Arctos2win
2024-01-24 21:19:13 +01:00
committed by GitHub
parent 0b01cfd287
commit e7654914e3
2 changed files with 9 additions and 0 deletions
+5
View File
@@ -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))
+4
View File
@@ -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)),