From c78c503cad2f308ae54e7356fe48c7776b32efc9 Mon Sep 17 00:00:00 2001 From: daffyyyy Date: Mon, 20 Nov 2023 22:19:07 +0100 Subject: [PATCH] Temp fix for command messages --- CS2-Tags.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/CS2-Tags.cs b/CS2-Tags.cs index 20251d5..67291e1 100644 --- a/CS2-Tags.cs +++ b/CS2-Tags.cs @@ -111,6 +111,14 @@ public class CS2_Tags : BasePlugin Server.PrintToChatAll(ReplaceTags($" {prefix}{nickColor}{player.PlayerName}{ChatColors.Default}: {messageColor}{info.GetArg(1)}")); + if (info.GetArg(1).StartsWith("!")) + { + CBasePlayerPawn pawn = new CBasePlayerPawn(NativeAPI.GetEntityFromIndex((int)player.EntityIndex!.Value.Value)); + var playerIndex = (int)pawn.Controller.Value.EntityIndex!.Value.Value; + + NativeAPI.IssueClientCommand(playerIndex, $"css_{info.GetArg(1).Replace("!", "")}"); + } + return HookResult.Handled; } @@ -128,8 +136,17 @@ public class CS2_Tags : BasePlugin string prefix = permissionTag["prefix"]?.ToString() ?? ""; string nickColor = permissionTag["nick_color"]?.ToString() ?? ""; string messageColor = permissionTag["message_color"]?.ToString() ?? ""; + Server.PrintToChatAll(ReplaceTags($" {prefix}{nickColor}{player.PlayerName}{ChatColors.Default}: {messageColor}{info.GetArg(1)}")); + if (info.GetArg(1).StartsWith("!")) + { + CBasePlayerPawn pawn = new CBasePlayerPawn(NativeAPI.GetEntityFromIndex((int)player.EntityIndex!.Value.Value)); + var playerIndex = (int)pawn.Controller.Value.EntityIndex!.Value.Value; + + NativeAPI.IssueClientCommand(playerIndex, $"css_{info.GetArg(1).Replace("!", "")}"); + } + return HookResult.Handled; } }