1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Oxide for Rust Legacy has been discontinued and is no longer supported. No updates or additions will be made, and Rust Legacy-specific plugin submissions will no longer be accepted. We recommend upgrading to the latest version of Rust as able.
    Dismiss Notice
  1. mcnovinho08

    mcnovinho08 Plugin Developer

    Hello recently I was trying to use the line break in rust legacy chat, but unfortunately it did not work, does anyone know a way?
     
  2. DraB

    DraB Plugin Developer

  3. P0LENT4

    P0LENT4 Plugin Developer

    I made this code quickly and did not test, but it might help

    Code (Text):
    bool OnPlayerChat(NetUser netuser, string message)
            {
                try
                {
                    var msg = rust.QuoteSafe(message);
                    var mstring = "";
                    if (msg.Length > 47)
                    {
                        var Name = rust.QuoteSafe(netuser.displayName);
                        for (var i = 1; i <= msg.Length - 2; i++)
                        {
                            mstring = mstring + msg[i];
                            if (((mstring.Length > 35) && (mstring[mstring.Length].ToString() == " ")) || (mstring.Length > 45))
                            {
                                ConsoleNetworker.Broadcast(string.Concat("chat.add ", Name, " ", mstring.ToLower()));
                                Name = ":";
                                mstring = "";
                            }
                        }
                        ConsoleNetworker.Broadcast(string.Concat("chat.add ", Name, " ", mstring.ToLower()));
                        return true;
                    }
                }
                catch
                {
                    var msg = rust.QuoteSafe(message);
                    var Name = rust.QuoteSafe(netuser.displayName);
                    ConsoleNetworker.Broadcast(string.Concat("chat.add ", Name, " ", msg.ToLower()));
                    return true;


                }
                return false;
            }