From f9f0b519b153559e5e52f4f2a6989f61244e1daa Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Thu, 22 Apr 2021 17:48:52 +0700 Subject: [PATCH] Add char coloring --- sources/Commands/BroadcastListener_Commands.uc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sources/Commands/BroadcastListener_Commands.uc b/sources/Commands/BroadcastListener_Commands.uc index 24b95bc..60ee218 100644 --- a/sources/Commands/BroadcastListener_Commands.uc +++ b/sources/Commands/BroadcastListener_Commands.uc @@ -27,6 +27,7 @@ static function bool HandleText( out string message, optional name messageType) { + local Text messageAsText; local APlayer callerPlayer; local Parser parser; local Commands commandFeature; @@ -39,8 +40,13 @@ static function bool HandleText( if (!commandFeature.useChatInput) return true; // We are only interested in messages that start with "!" parser = __().text.ParseString(message); - if (!parser.Match(P("!")).Ok()) { + if (!parser.Match(P("!")).Ok()) + { parser.FreeSelf(); + // Convert color tags into colors + messageAsText = __().text.FromFormattedString(message); + message = messageAsText.ToColoredString(,, __().color.White); + messageAsText.FreeSelf(); return true; } // Extract `APlayer` from the `sender`