From f3113127e4346752ba438e89abb14f44aee47566 Mon Sep 17 00:00:00 2001 From: Mikhail Reznichenko Date: Mon, 29 Jul 2024 22:16:41 +0300 Subject: [PATCH] fixed crash --- Commands/ShakhedBoom.cs | 1 + Handlers/Player.cs | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Commands/ShakhedBoom.cs b/Commands/ShakhedBoom.cs index 086cdf7..766fba6 100644 --- a/Commands/ShakhedBoom.cs +++ b/Commands/ShakhedBoom.cs @@ -28,6 +28,7 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s return false; } playerSender.Explode(ProjectileType.FragGrenade, playerSender); + VeryUsualDay.Instance.Shakheds.Remove(playerSender.Id); response = "Бабах."; return true; } diff --git a/Handlers/Player.cs b/Handlers/Player.cs index 0850b64..3891ef6 100644 --- a/Handlers/Player.cs +++ b/Handlers/Player.cs @@ -1,4 +1,5 @@ -using System.Runtime.CompilerServices; +using System.Linq; +using System.Runtime.CompilerServices; using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features; @@ -226,9 +227,10 @@ public static void OnVerified(VerifiedEventArgs ev) public static void OnHurt(HurtEventArgs ev) { - if (VeryUsualDay.Instance.Config.BlowingDamageTypes.Contains(ev.DamageHandler.Type)) + if (VeryUsualDay.Instance.Shakheds.Contains(ev.Player.Id) && VeryUsualDay.Instance.Config.BlowingDamageTypes.Contains(ev.DamageHandler.Type)) { - ev.Player.Explode(ProjectileType.FragGrenade, ev.Attacker); + VeryUsualDay.Instance.Shakheds.Remove(ev.Player.Id); + ev.Player.Explode(ProjectileType.FragGrenade); } if (!VeryUsualDay.Instance.IsEnabledInRound || !ev.Player.TryGetSessionVariable("vudmood", out string mood)) return;