public void OnHealed(UsingItemEventArgs ev) { if (ev.Item == null) { return; } int chance = Gen.Next(1, 100); if (ev.Player.ReferenceHub.TryGetComponent(out SCP008 scp008)) { switch (ev.Item.Type) { case ItemType.SCP500: UnityEngine.Object.Destroy(scp008); Log.Debug($"{ev.Player} successfully cured themselves.", SCP008X.Instance.Config.DebugMode); break; case ItemType.Medkit: if (chance <= SCP008X.Instance.Config.CureChance) { goto case ItemType.SCP500; } break; } } }
/// <inheritdoc cref="Exiled.Events.Handlers.Player.OnUsingItem(UsingItemEventArgs)"/> public void OnUsingItem(UsingItemEventArgs ev) { Log.Info($"{ev.Player.Nickname} is trying to use {ev.Item.Type}."); if (ev.Item.Type == ItemType.Adrenaline) { Log.Info($"{ev.Player.Nickname} was stopped from using their {ev.Item.Type}!"); ev.IsAllowed = false; } }
private void OnUsingItem(UsingItemEventArgs ev) { if (!Check(ev.Player.CurrentItem)) { return; } IEnumerable <Player> scp096s = Player.Get(RoleType.Scp096); Timing.CallDelayed(1f, () => { foreach (Player scp in scp096s) { if (scp.CurrentScp is PlayableScps.Scp096 scp096 && scp096.HasTarget(ev.Player.ReferenceHub)) { scp096._targets.Remove(ev.Player.ReferenceHub); } }
/// <summary> /// Called before using a medical item. /// </summary> /// <param name="ev">The <see cref="UsingItemEventArgs"/> instance.</param> public static void OnUsingItem(UsingItemEventArgs ev) => UsingItem.InvokeSafely(ev);