Merge pull request #1834 from seltonmt012/fix/saveplayers-spawned-guard

fix(es_extended/server): skip unspawned players in the bulk save
This commit is contained in:
_Not_
2026-08-14 19:43:34 -05:00
committed by GitHub
+6
View File
@@ -251,6 +251,7 @@ function Core.SavePlayers(cb)
local parameters = {}
for _, xPlayer in pairs(ESX.Players) do
if xPlayer.spawned then
updateHealthAndArmorInMetadata(xPlayer)
parameters[#parameters + 1] = {
json.encode(xPlayer.getAccounts(true)),
@@ -264,6 +265,11 @@ function Core.SavePlayers(cb)
xPlayer.identifier,
}
end
end
if not parameters[1] then
return cb and cb()
end
MySQL.prepare(
"UPDATE `users` SET `accounts` = ?, `job` = ?, `job_grade` = ?, `group` = ?, `position` = ?, `inventory` = ?, `loadout` = ?, `metadata` = ? WHERE `identifier` = ?",