From 8d62969248d073508fa1d853e2260218952c6039 Mon Sep 17 00:00:00 2001 From: Selt <83926739+seltonmt012@users.noreply.github.com> Date: Mon, 27 Jul 2026 03:07:15 +0200 Subject: [PATCH] fix(es_extended/server/main): skip unknown weapons when loading a loadout ESX.GetWeaponLabel asserts on a name that is not in Config.Weapons, so it never returns a falsy value and the `if label then` check below it can never skip anything. The assert propagates out of loadESXPlayer, which means the player object is never created and esx:playerLoaded never fires - the player is stuck on the loading screen and hits the same error on every reconnect. This happens whenever a saved loadout holds a weapon the config no longer knows, for example after changing sv_enforceGameBuild or after removing a weapon from shared/weapons.lua. Wrapping the lookup keeps GetWeaponLabel itself untouched and lets the existing check do what it was written for. --- [core]/es_extended/server/main.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/[core]/es_extended/server/main.lua b/[core]/es_extended/server/main.lua index 65bc3fd47..39692593f 100644 --- a/[core]/es_extended/server/main.lua +++ b/[core]/es_extended/server/main.lua @@ -293,9 +293,9 @@ function loadESXPlayer(identifier, playerId, isNew) local loadout = json.decode(result.loadout) for name, weapon in pairs(loadout) do - local label = ESX.GetWeaponLabel(name) + local found, label = pcall(ESX.GetWeaponLabel, name) - if label then + if found and label then userData.loadout[#userData.loadout + 1] = { name = name, ammo = weapon.ammo,