undo(es_extended/server/main.lua): revert 'playerConnecting' stale data removing logic

This commit is contained in:
Tabby Dev
2025-05-30 21:20:04 +08:00
parent 29ac804070
commit 20e36fa15a
+18 -3
View File
@@ -119,9 +119,24 @@ if not Config.Multichar then
return deferrals.done("[ESX] There was an error loading your character!\nError code: identifier-missing\n\nThe cause of this error is not known, your identifier could not be found. Please come back later or report this problem to the server administration team.")
end
TriggerEvent('esx:playerCrashed', identifier, function()
deferrals.update(("[ESX] Cleaning old Player entry for [%s] (player invalid)"):format(identifier))
end)
local xPlayer = ESX.GetPlayerFromIdentifier(identifier)
if xPlayer and ESX.Players[xPlayer.playerId] then
local xPlayerId = xPlayer.playerId
local isExist = DoesPlayerExist(xPlayerId --[[@as string]])
if isExist ~= 0 then
deferrals.update(("[ESX] Cleaning old Player entry for [%s] (player invalid)"):format(identifier))
TriggerEvent('esx:playerDropped', xPlayerId)
ESX.Players[xPlayerId] = nil
Core.playersByIdentifier[identifier] = nil
GlobalState['playerCount'] = GlobalState['playerCount'] - 1
else
return deferrals.done(
("[ESX] There was an error loading your character!\nError code: identifier-active\n\nThis error is caused by a player on this server who has the same identifier as you have. Make sure you are not playing on the same account.\n\nYour identifier: %s"):format(identifier)
)
end
end
return deferrals.done()
end)