refactor(es_extended/server/main): early return

This commit is contained in:
Kenshin13
2025-06-14 20:40:27 +02:00
parent 5e6fbd1661
commit 85881a4fde
+17 -16
View File
@@ -121,24 +121,25 @@ if not Config.Multichar then
local xPlayer = ESX.GetPlayerFromIdentifier(identifier)
if xPlayer 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
if not xPlayer then
return deferrals.done()
end
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
return deferrals.done()
end)
end