1. The code:

    Code:
    using System;
    using System.Collections;
    using System.Collections.Generic;using Oxide.Core;
    using Oxide.Core.Configuration;
    using Oxide.Core.Plugins;namespace Oxide.Plugins
    {
        [Info("RandomNotices", "Goku", "1.0.0")]
        [Description("Show random notices in every time")]
        class RandomNotices : RustPlugin
        {
            // | Prefix | Time | True or false (ONFF)
            static string chatprefix = "RANDOMNOTICES";
            static string colorprefix = "#FF0000";
            bool ONOFF = true;
            float timeRepeat = 0.5f;        // GET A LIST:        readonly List<string> RandomMessages = new List<string>(new string[]{
                "Type /commands list to get a full list commands",
                "Type /ff (on|off) to enable / disable your friendly fire",
                "Type /friend [add|remove|list] to add / remover or list your friends."
            });        // GET A CONFIG FILE        void LoadDefaultConfig()
            {
                PrintWarning("The config has been created of the plugin: RandomNotices");
                Config.Clear();
                Config["Tag prefix in chat"] = chatprefix;
                Config["Tag prefix in chat (COLOR)"] = colorprefix;
                Config["Active system (TRUE: ON | FALSE: OFF)"] = ONOFF;
                Config["Time to repeat the notices"] = timeRepeat;
                Config["Messages"] = RandomMessages;
                SaveConfig();
            }        // GET A RANDOM STRING IN THE LIST 'VOID'        void TimerT()
            {
                System.Random rand = new System.Random();
                int next = rand.Next(RandomMessages.Count);
                string message = RandomMessages[next];
                timer.Repeat(timeRepeat * 60, 0, () =>
                {
                    rust.BroadcastChat("<color=" + colorprefix + ">" + chatprefix + "</color> : " + message);
                    PrintWarning(message);
                });
            }        void Loaded()
            {
                TimerT();
            }
        }
    }
    Are generating a message, that is, a first message in the chat, if you reload it it will move to the next message and keep repeating ;-; Please help-me to random mensagem in the list..

    OBS:. The PrintWarning is for test the messages
     
  2. Wulf

    Wulf Community Admin

    Why not use the AutoBroadcast plugin? It already does this.
     
  3. Oh I did not know this plugin, but it's also because I want to study a little more and to know why this happens if I want to create future plugins.
     
  4. Wulf

    Wulf Community Admin

    If you'd like to take a look to see how it works (or to use it): AutoBroadcast.
     
  5. Yes, I'm looking as you like, thank you very much Wulf