We've moved! Join us as we continue development on our new site at umod.org!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  1. Code:
            private void OnMeleeThrown(BasePlayer player, Item item)
                var weapon = player.GetActiveItem().GetHeldEntity() as ThrownWeapon;
                if (this.weapon == null) return;
                weapon.GetItem().amount += 1;
    Basically got alot working but can anyone tell me why this doesnt work?
    Started today :)
  2. First thing i can notice is this.weapon

    If you are copying things from the assembly, don't forget to change any variable's names so it actually works.

    Also, generally you will want to null check everything before you use it.

    I suggest taking a look into null condition operators which will make life a lot easier; Null-conditional Operators (C# and Visual Basic)