1. Trying to set the bullets amount inside a weapon, but it seems i can't --'
    Copy-Paste for Rust | Oxide

    As the weapon is inside a loot container, the usually .HeldEntity() doesn't work to get the BaseProjectile then get the Magazine.
    I wasn't able to find a way to get to the magazine from a weapon inside a box :/

    Any ideas?
     
  2. Grabbing the item from the itemList and then using .GetHeldEntity() works for me. Here is some code from my test plugin that is full of useless stuff :p
    Code:
    private void GetAmmo(StorageContainer container)
            {
                var item = container.inventory.itemList[0];
                if (item != null)
                {
                    var heldent = item.GetHeldEntity() as BaseProjectile;
                    var ammo = heldent.primaryMagazine.contents;               
                }
            }
     
  3. .GetHeldEntity works even if the entity is inside a box? and not held by a player?
     
  4. Yep, you just need the Item. Its the same way I collect all the weapon info from a players inventory prior to starting a event.
     
  5. thx :) works