#Checking if player WILL have space for an item

1 messages · Page 1 of 1 (latest)

twin sky
#

I have a trading system where it opens a GUI and you can place your items inside that gui. Everything works fine but I don't know how to check if the player will have space for the item that has been placed inside the gui. Here's the current code ```on inventory click:
cancel event

if clicked inventory = player's inventory:
    event-slot is not air

    set {_tradeGUI} to {-trade::%uuid of player%::tradeGUI}

    loop {@inventorySlots}:
        if slot loop-value of  {_tradeGUI} is air:

            if player has space for event-slot:

                set slot loop-value of {_tradeGUI} to event-slot
                set event-slot to air

                stop loop``` It works until the player has one free slot in their inventory, then you can place unlimited amount of items because when you place an item inside the trading gui it will disappear from the player's inventory. Is there a way to save the player's inventory into a variable or something to be able to use `if player has space for event-slot`?
spice swift
#

yes

#

save the inv to a metadata, then check if that has room

twin sky
spice swift
#

yes

twin sky
#

the problem is still up

#

if the player has one slot free you can put more items than the player's inventory can hold

#

isn't there a way to add the item that has been placed inside the trading gui to the variable?