diff --git a/server/classes/player.lua b/server/classes/player.lua index 15f2b57a..546a26b3 100644 --- a/server/classes/player.lua +++ b/server/classes/player.lua @@ -416,6 +416,11 @@ function CreateExtendedPlayer(player, accounts, inventory, job, loadout, name, l if self.loadout[i].name == weaponName then weaponLabel = self.loadout[i].label + for j=1, #self.loadout[i].components, 1 do + TriggerClientEvent('esx:removeWeaponComponent', self.source, weaponName, self.loadout[i].components[j]) + table.remove(self.loadout[i].components, j) + end + table.remove(self.loadout, i) break end diff --git a/server/commands.lua b/server/commands.lua index 0b585460..6d0a7d78 100644 --- a/server/commands.lua +++ b/server/commands.lua @@ -239,7 +239,7 @@ TriggerEvent('es:addGroupCommand', 'clearloadout', 'admin', function(source, arg return end - for i=1, #xPlayer.loadout, 1 do + for i=#xPlayer.loadout, 1, -1 do xPlayer.removeWeapon(xPlayer.loadout[i].name) end end, function(source, args, user)