Delay inventory load until character identity is set (non-multicharacter)

Inventory was loading before firstName and lastName were assigned to new
characters when multicharacter was disabled.

Fix:
* Check if multicharacter is disabled (Config.Multichar)
* Identify new characters (isNew)
* Wait for firstName and lastName to exist
* Recheck every 3 seconds

Ensures identity data loads before inventory initializes
This commit is contained in:
SNAILX
2025-10-17 17:33:31 +01:00
committed by GitHub
parent b3deeae1eb
commit f9792d8117
+5
View File
@@ -354,6 +354,11 @@ function loadESXPlayer(identifier, playerId, isNew)
if not Config.CustomInventory then
xPlayer.triggerEvent("esx:createMissingPickups", Core.Pickups)
elseif setPlayerInventory then
if not Config.Multichar and isNew and not xPlayer.get("firstName") and not xPlayer.get("lastName") then
while not xPlayer.get("firstName") and not xPlayer.get("lastName") do
Wait(3000)
end
end
setPlayerInventory(playerId, xPlayer, userData.inventory, isNew)
end