fix(server/commands): /clearloadout will properly wipe all weapons

Loadout indexes are being updated while the loop runs causing it to break after removing a few weapons.
This reverts the command to how it worked prior to ESX 1.2
This commit is contained in:
Linden
2021-06-03 19:38:29 +10:00
committed by GitHub
parent ca6462ad6a
commit 3ff2f4ac74
+2 -2
View File
@@ -117,8 +117,8 @@ end, true, {help = _U('command_clearinventory'), validate = true, arguments = {
}})
ESX.RegisterCommand('clearloadout', 'admin', function(xPlayer, args, showError)
for k,v in ipairs(args.playerId.loadout) do
args.playerId.removeWeapon(v.name)
for i=#args.playerId.loadout, 1, -1 do
xPlayer.removeWeapon(args.playerId.loadout[i].name)
end
end, true, {help = _U('command_clearloadout'), validate = true, arguments = {
{name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'}