C#:
using Newtonsoft.Json;
namespace Oxide.Plugins
{
[Info("Startup Commands", "Disney", "1.0.1")]
[Description("A really cool plugin by the legend Disney himself!")]
public class StartupCommands : RustPlugin
{
#region Config Object
private ConfigData configData;
private class ConfigData
{
[JsonProperty(PropertyName = "Commands To Execute")]
public string[] commands { get; set; } =
{
"minicopter.population 1",
"minicopter.outsidedecayminutes 2880",
"minicopter.outsidedecayminutes 480",
"scraptransporthelicopter.population 0.33",
"motorrowboat.population 1",
"motorrowboat.deepwaterdecayminutes 120",
"motorrowboat.outsidedecayminutes 180",
"rhib.rhibpopulation 1",
"hotairballoon.population 1",
"hotairballoon.outsidedecayminutes 180",
"server.description \"A really cool Rust server!\""
};
}
#endregion Config Object
#region Config Init
private bool LoadConfigVariables()
{
try { configData = Config.ReadObject<ConfigData>(); }
catch { return false; }
SaveConfig(configData);
return true;
}
void Init()
{
if (!LoadConfigVariables()) { Puts("reset the config"); return; }
}
protected override void LoadDefaultConfig()
{
Puts("Creating New Config File");
configData = new ConfigData();
SaveConfig(configData);
}
void SaveConfig(ConfigData config) => Config.WriteObject(config, true);
#endregion Config Init
void Loaded()
{
foreach (var command in configData.commands) { Server.Command(command); }
Server.Command("writecfg");
}
}
}