1. When a player type a word in the chat I want to intercept the message and change the word into something else. The problem is I can't find a way to broadcast the message to all player in the server (like the normal global chat works) and display the name and icon of the player at the same time.

    Here's what I tried so far:

    Code:
    object OnPlayerChat(ConsoleSystem.Arg arg)
            {
                string original = arg.GetString(0, "text");
                string replaced = original.Replace(Convert.ToString(Config["PASSWORD"]), "****");
              
                BasePlayer player = arg.connection.player as BasePlayer;
              
                //We found something
                if(original != replaced)
                {
                    rust.BroadcastChat(message, player.displayName, Convert.ToString(player.userID));
                    return false;
                }
              
                return null;
              
            }
     
  2. Wulf

    Wulf Community Admin

    What you had was almost right, but swapped a bit, but you don't need to convert to a string, it already exists as one:
    Code:
    rust.BroadcastChat(player.displayName, message, player.UserIDString);
    For reference: Oxide/Rust.cs at master · OxideMod/Oxide · GitHub
     
  3. Thanks Wulf, you're always very helpful. Just one more question, when I use this function the player name comes in orange by default (just like the implementation in github says). Do you know the color code for the default name color? (I tried all the blues provided in the docs: Rust)
     
  4. Wulf

    Wulf Community Admin

    Just add color tags to change it. Default Rust chat color hex codes? | Oxide