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 ListList")] public List commands = new List(); } private bool LoadConfigVariables() { try { configData = Config.ReadObject(); } 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++; }); } } } } }