Closed D1GQ closed 4 months ago
For some reason the clear chat is only client-sided, that's why it's not working for example the mute command.
public static void Announce(string announcement, bool keepHistory = false) { if (Helper.LocalPlayer is not PlayerControllerB player) return; if (Helper.HUDManager is not HUDManager hudManager) return; string actualHistory = string.Join('\n', hudManager.ChatMessageHistory.Where(message => !message.StartsWith("<color=#FF0000>USER</color>: <color=#FFFF00>'") && !message.StartsWith("<color=#FF0000>SYSTEM</color>: <color=#FFFF00>'") )); string chatText = keepHistory ? $"{actualHistory}\n<color=#7069ff>{announcement}</color>" : announcement; hudManager.AddTextToChatOnServer( $"</color>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n{chatText}<color=#FFFFFF00>", (int)player.playerClientId ); } public static void Clear() { Chat.Announce(""); }
Strange. I'll look into it. It's weird because AddTextToChatOnServer works properly in the say command.
AddTextToChatOnServer
say
Fixed in latest.
For some reason the clear chat is only client-sided, that's why it's not working for example the mute command.
Problematic Code