namespace Oxide.Plugins { [Info("Explosives Detonation", "Beast_", "1.0.1")] [Description("Detonate the explosives on shooting them.")] public class ExplosivesDetonation : RustPlugin { private const string PERM_USE = "explosivesdetonation.use"; private void Init() { permission.RegisterPermission(PERM_USE, this); } private object OnPlayerAttack(BasePlayer attacker, HitInfo info) { if (attacker == null) return null; if (!permission.UserHasPermission(attacker.UserIDString, PERM_USE)) return null; if (info == null || info?.HitEntity?.net == null) return null; var hitEntity = info.HitEntity as TimedExplosive; if (hitEntity == null || !hitEntity.IsValid()) return null; var heldEntity = attacker.GetHeldEntity(); if (heldEntity == null || heldEntity is BowWeapon || heldEntity is BaseMelee) return null; hitEntity.Explode(); return null; } } }