Im trying to detect if the Projectile of the HitInfo from OnPlayerAttack is a thrown weapon, or not...
kinda stuck..
Code:void OnPlayerAttack(BasePlayer attacker, HitInfo hitInfo) { var project = hitInfo?.Weapon?.GetItem()?.GetHeldEntity() as BaseProjectile ; var Mag = project.primaryMagazine ?? null; if (Mag == null) return;......
Find out if the Projectile is a Thrown Weapon
Discussion in 'Rust Development' started by Crushed, Nov 14, 2017.
-
BaseProjectile is of Type AttackEntity, which is a type of HeldEntity.
Therefore you could check the "info.Weapon", which is already AttackEntity, being a ThrownWeapon -
May not be all you need, but HitInfo has HitInfo.IsProjectile().
-
already got it thanks
tested it. and somehow- this was already enough
Code:AttackEntity Thrown = attacker.GetHeldEntity() as AttackEntity ; if (!Thrown) return;