Skip to content

Commit b84ee87

Browse files
committed
Merge branch 'slejm/Player-RemoveItem-fix' into 'dev'
Fix Player.RemoveItem inventory bug See merge request SCPSL/LabAPI-Internal!338
2 parents 37298d1 + f77202d commit b84ee87

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

LabApi/Features/Wrappers/Players/Player.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,9 +1481,11 @@ public void IntercomUnmute(bool revokeMute)
14811481
public void RemoveItem(ItemType item, int maxAmount = 1)
14821482
{
14831483
int count = 0;
1484-
for (int i = 0; i < Items.Count(); i++)
1484+
Item[] items = Items.ToArray();
1485+
for (int i = 0; i < items.Length; i++)
14851486
{
1486-
ItemBase? itemBase = Items.ElementAt(i).Base;
1487+
ItemBase itemBase = items[i].Base;
1488+
14871489
if (itemBase.ItemTypeId != item)
14881490
{
14891491
continue;

0 commit comments

Comments
 (0)