1. Hello,

    I post a lot recently but I really want to get my plugin working :D

    Code:
    private void OnEntityTakeDamage(BaseCombatEntity entity, HitInfo hitInfo)
            {
                if (entity is BuildingBlock)
                {
                    var block = entity as BuildingBlock;                if (block == null)
                        return;                if (block.grade == BuildingGrade.Enum.Wood)
                        hitInfo.damageTypes.Scale(Rust.DamageType.Slash, 4);
                    if (block.grade == BuildingGrade.Enum.Stone)
                        hitInfo.damageTypes.Scale(Rust.DamageType.Slash, 80);            }            if (entity is Door)
                    hitInfo.damageTypes.Scale(Rust.DamageType.Slash, 5);            else return;
            }
    I am using OnEntityTakeDamage and I want to check if the user is using a salvaged.sword when hitting a wall, I have tried multiple different combinations and I either get Null Reference errors or method takes 0 arguments.

    I altered the below code that Kayzor posted... but I couldn't get it to work.

    Code:
    bool checkItem(BasePlayer player, string command, string[] args)
            {
                Item item = player.GetActiveItem();
                if (item != null)
                {
                    var weapon = item.GetHeldEntity() as BaseProjectile;
                    if (weapon != null && weapon.Equals("salvaged.sword"))
                    {
                        return true;
                    }
                }
                else
                {
                    return false;
                }
            }
    I wanted to use checkItem to check if the active item is salvaged.sword and then

    Code:
    if (block.grade == BuildingGrade.Enum.Wood && checkItem())
    hitInfo.damageTypes.Scale(Rust.DamageType.Slash, 4);
     
  2. What against checking it direct from the hitinfo?
    Code:
    hitInfo.Weapon?.GetItem().info.shortname
     
  3. I wasn't sure you could do that, I will give that a shot now! Thanks.