1. Hello,

    (I have found nothing, excuse me if available)
    There is a hook to know the contents of the inventory of a player?

    I modified "m-Teleportation" to prohibit the teleportation with C4
    and prohibit teleportation when overflow inventory.
     
  2. Calytic

    Calytic Community Admin Community Mod

    Code:
            object canTeleport(BasePlayer player)
            {
                if (player.inventory.AllItems().Length == 24)
                {
                    return "You cannot teleport with that much";
                }            if (player.inventory.GetAmount(498591726) > 0)
                {
                    return "You cannot teleport with Timed Explosives";
                }            return null;
            }
    I didn't test this, but something like this should work. It will prevent you from teleporting with a full inventory or if you have any c4.
     
  3. Thank you very much, I will work with it.
    Code:
        if player.inventory.AllItems().Length == 24 then
            self:SendMessage(player, self.Config.Messages.HomeTPInventory)
            return
        end
        if player.inventory.GetAmount(498591726) > 0 then
            self:SendMessage(player, self.Config.Messages.HomeTPInventoryC4)
            return
        end
    Question beast, how did you know? For there is nothing in: Oxide API for Rust
     
  4. Wulf

    Wulf Community Admin

    It's from Rust's DLL, not Oxide. You'd use a decompiler such as JustDecompile to view the relevant portions (player.inventory, etc.)
     
  5. There is a method to control the number of objects in the main inventory only?
    Like :
    Code:
          if (player.inventory.GetContainer(Main).Length = 24)
           {
             return MessageErrorFullInventory;
           }
    
    ( The name `containerMain'/ 'Main' does not exist in the current context )
     
    Last edited by a moderator: Jan 30, 2016
  6. Code:
    if(player.inventory.GetContainer(PlayerInventory.Type.Main).itemList.Count == 24)
    Code:
    if(player.inventory.containerMain.itemList.Count == 24)
     
  7. Thank you !
    I tried this method but I had forgotten to replace "Length" to "Count" ><