1. I'm writing a little script that gives players rewards, but I'd like to check whether player has space before I run it.

    Is there an easy way to check there is space in the current player inventory before I drop the reward?

    I'm currently using:

    Code:
    foreach(BasePlayer player in BasePlayer.activePlayerList) {
          
        CODE...}
    Thanks.
     
  2. I'd do it this way...

    Code:
    if (!player.inventory.containerMain.IsFull() || !player.inventory.containerBelt.IsFull())
                {
                    //CODE
                }
     
  3. You probably wouldn't want to just check .IsFull if you are giving out more than 1 item.

    Check out
    Kits for Rust | Oxide
    Kits plugin does this type of check
    Search for the line that has "if ((player.inventory.containerBelt.capacity". It checks to see if the number of available slots is less than the amount of items you are trying to give.
     
  4. Thanks - I'm only giving out one item; I'm not that generous :)

    I'll give that a go!
     
  5. Check out the MoveToContainer for the Item class, it's a bool and can be used like this:

    Code:
    if (!item.MoveToContainer(container))
    {
    //failed to move! (full)
    }
    
    MoveToContainer also has optional arguments for target position (which slot in the inventory) and "allowStack", which I'm guessing if set to false tries to move it to a new stack instead of an existing one if there is one.
     
  6. Thanks Shady, that also is useful to know :)