diff --git a/CounterStrikeSharp.API.dll b/CounterStrikeSharp.API.dll index 731b6d2..7f66694 100644 Binary files a/CounterStrikeSharp.API.dll and b/CounterStrikeSharp.API.dll differ diff --git a/Game-Manager-GoldKingZ.cs b/Game-Manager-GoldKingZ.cs index 0ad3928..bcbb625 100644 --- a/Game-Manager-GoldKingZ.cs +++ b/Game-Manager-GoldKingZ.cs @@ -12,14 +12,12 @@ using CounterStrikeSharp.API.Modules.Memory; using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions; using CounterStrikeSharp.API.Core.Attributes.Registration; - namespace Game_Manager_GoldKingZ; -[MinimumApiVersion(276)] public class GameManagerGoldKingZ : BasePlugin { public override string ModuleName => "Game Manager (Block/Hide Unnecessaries In Game)"; - public override string ModuleVersion => "2.0.7"; + public override string ModuleVersion => "2.0.8"; public override string ModuleAuthor => "Gold KingZ"; public override string ModuleDescription => "https://github.com/oqyh"; internal static IStringLocalizer? Stringlocalizer; @@ -62,6 +60,7 @@ public override void Load(bool hotReload) return HookResult.Continue; }, HookMode.Pre); + HookUserMessage(208, um => { var soundevent = um.ReadUInt("soundevent_hash"); @@ -611,8 +610,6 @@ public HookResult OnEventGrenadeThrown(EventGrenadeThrown @event, GameEventInfo if (Configs.GetConfigData().CustomThrowNadeMessagesMode == 0 || player == null || !player.IsValid || Configs.GetConfigData().CustomThrowNadeMessagesMode == 1 && player.IsBot)return HookResult.Continue; Server.NextFrame(() => { - - var playerteam = player.TeamNum; var allplayers = Helper.GetPlayersController(true,false); @@ -623,14 +620,15 @@ public HookResult OnEventGrenadeThrown(EventGrenadeThrown @event, GameEventInfo var otherteam = players.TeamNum; bool sameTeam = playerteam == otherteam; bool teammatesAreEnemies = ConVar.Find("mp_teammates_are_enemies")!.GetPrimitiveValue(); - var Nadelocation = players.PlayerPawn.Value.LastPlaceName; + + string Nadelocation = player?.PlayerPawn?.Value?.LastPlaceName ?? "Unknown"; if (sameTeam && !teammatesAreEnemies) { - Helper.SendGrenadeMessage(nade, players, player.PlayerName, Nadelocation.ToString()); + Helper.SendGrenadeMessage(nade, players, player!.PlayerName, Nadelocation.ToString()); } else if (sameTeam && player != players ) { return; } else if (sameTeam && (Configs.GetConfigData().CustomThrowNadeMessagesMode == 3 || Configs.GetConfigData().CustomThrowNadeMessagesMode == 4)) { - Helper.SendGrenadeMessage(nade, players, player.PlayerName, Nadelocation.ToString()); + Helper.SendGrenadeMessage(nade, players, player!.PlayerName, Nadelocation!.ToString()); } }); });