Иконка ресурса

FREE OneForAll : 1.0.0 1.0.0

Нет прав для скачивания
C#:
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;

namespace Oxide.Plugins
{
    [Info("OneForAll", "MikeHawke", "1.0.0")]
    [Description("Call multiple server commands from one command")]
    class OneForAll : RustPlugin
    {
        private ConfigData configData;
        class ConfigData
        {
            [JsonProperty(PropertyName = "Command List")]
            public List<string> commands = new List<string>();
        }
        private bool LoadConfigVariables()
        {
            try
            {
                configData = Config.ReadObject<ConfigData>();
            }
            catch
            {
                return false;
            }
            SaveConfig(configData);
            return true;
        }
        void Init()
        {
            if (!LoadConfigVariables())
            {
                Puts("Config file issue detected. Please delete file, or check syntax and fix.");
                return;
            }
        }
        protected override void LoadDefaultConfig()
        {
            Puts("Creating new config file.");
            configData = new ConfigData();
            SaveConfig(configData);
        }

        void SaveConfig(ConfigData config)
        {
            Config.WriteObject(config, true);
        }
        [ConsoleCommand("OFA")]
        void Oneforall(ConsoleSystem.Arg arg)
        {
            if (arg.IsAdmin)
            {
                int refnum = 0;
                var coms = configData.commands.ToList();
                for (int i = 0; i < coms.Count; i++)
                {
                    timer.Once(i + 1, () =>
                    {
                        covalence.Server.Command(coms[refnum]);
                        refnum++;
                    });
                }
            }
        }
    }
}

Автор
15FPS
Скачиваний
0
Просмотры
1
Первый выпуск
Обновление
Оценка
0.00 звёзд 0 оценок
Сверху