How can get number of extra slots?

Title,

I got items each other
they filled the inventory
the code return 0

How do you mean “extra slots”? Whats your current code? Could you go into a little more detail?