Looking at your array_inv_items the cheese(sword) and apples which are loaded into the array are not being removed from the array when given away. Therefore I would say that no other items can be loaded into the array because all of the array elements are full.
There are other issues such as multiple instances of an item being destroyed when giving one of theose item types away.
Is the desired behaviour this: Move item into 1 of 4 inventory slots, when the item is used/given away that inventory slot then becomes empty?
Are you also wanting to move other remaining items towards the left when one is used so that when a new item is added it is added at the end or right hand side?