1. Hey,

    For a while now, rust.BroadcastChat({ }); does not work.. Ever..

    I have NO idea why and I have updated it to the latest version (2.0.622).
    Please help,

    This is my code:
    Code:
    namespace Oxide.Plugins
    {
        [Info("Commands!", "Krazi", "1.0.0")]
        public class Commands : RustPlugin
        {
            [ChatCommand("afkc")]
            void cmdAfk(BasePlayer player, string cmd, string[] args)
            {
                player.StartSleeping();            if(player.IsSleeping())
                {
                    var messageT = string.Format("{0} is now awake", player.displayName);
                    rust.BroadcastChat({ messageT }); //HERE IS WHERE IT DOES  NOT WORK
                    //Notice how I use PrintToChat down there because I can't use BroadcastChat.. 
                    //And I don't think PrintToChat goes to everyone because it uses BasePlayer. :P
                }
            }        void OnPlayerInit(BasePlayer player)
            {
                PrintToChat(player, "<color=#008080ff>QUARK:</color> {0} has joined the server!", player.displayName);
            }
        }
    }
     
  2. Try it:
    Code:
    ConsoleSystem.Broadcast("chat.add", new object[] { "0", "<color=lime>[Server]:</color> Test Message" });
     
  3. Nope doesn't work..
     
  4. Wulf

    Wulf Community Admin

  5. So I could use broadcastchat but just don't use rust.?
    [DOUBLEPOST=1427730814][/DOUBLEPOST]Well that doesn't work lol.

    Can yuo show me how I could use that in my code?

    And explain what the arguments are. :3 sorry I just want to understand what I'm doing.
     
  6. Wulf

    Wulf Community Admin

    You can use exactly what I linked, which is the actual function from Rust itself instead of the function that we add for non C# plugins to use.
     
  7. [​IMG]
    It's working fine
     
  8. Weird. I get a ton of warning and one compiling error..
     
  9. Wulf

    Wulf Community Admin

  10. can u post ur errors?
     
  11. Do you mind exmapling the arguments of all that? like ConsoleSystem.Broadcast(what does this mean);

    That's working now, and I just want to understand it more. :/ sorry. Thanks for the help!

    If you could help me with what I told Wulf it'd be great, thanks.
     
  12. Oh, wait, as said Wulf we're using it wrong :p

    You need to use it:
    Code:
    ConsoleSystem.Broadcast("chat.add", "0", "<color=lime>[Server]:</color> Test Message", 1);
     
  13. Wulf

    Wulf Community Admin

    Nothing wrong with that way, but it can be used exactly as shown on GitHub too. ;)
    Code:
    ConsoleSystem.Broadcast("chat.add", 0, string.Format("<color=orange>{0}:</color> {1}", "SERVER", "Hello World"), 1.0);
     
  14. Oh ok! Thanks!

    But can you guys explain what it all means? Like ConsoleSystem.Broadcast(arg1, arg2, arg3, arg4); and explain what the arguments are.

    lol sorry,

    thanks for the feedback!
     
  15. I do not like the format , if we can make the string yourself, it is best to do so.
     
  16. Wulf

    Wulf Community Admin

    With the version from GitHub: Command, steamid64, message formatting, chat name, message, global chat setting.
     
  17. "chat.add" command which will be launched in player's console
    "0" chat icon, if 0 then it will be Rust icon else it will be avatar that have this steamid (like "75653242346") [1 argument]
    "<color=lime>[Server]:</color> Test Message" message [2 argument]
    "1" global chat [3 argument]
     
  18. Oh ok!

    So the command is "chat.add", cuz your 'adding to the chat' lol, steamid64 which we don't need in this case so 0, message formatting which is the actualy message, and then global chat setting which I assume needs to be 1 since it's declaring it's 'global-ness' and if I where 0 then it wouldn't work or not be global.

    Something like that lol.
    [DOUBLEPOST=1427733088][/DOUBLEPOST]
    Ahhhhhh thanks!
    I was so terribly wrong XD LOL

    Both of you are awesome!

    Thanks SO much!
     
  19. Wulf

    Wulf Community Admin

    That's it! Bombardir has a more detailed message above if you're interested. :)
     
  20. I understand completely!

    I love the Oxide API lol.. It's so fun to learn stuff like this.

    Before the rust.BroadcastChat was working fine, then I updated and it must've been removed or something lol.

    Thanks again!
    [DOUBLEPOST=1427733474][/DOUBLEPOST]Hey, just want to ask one more easy question for yall before you go,

    Why do we need the string.*Format* there? Why can't we do string("{0}", "SERVER"); or something?

    lol thanks