C#:
using Oxide.Core;
using Oxide.Core.Plugins;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Oxide.Plugins
{
[Info("Server Population", "Soller", "1.0.1")]
public class ServerPopulation : RustPlugin
{
private ConfigData config;
private class ConfigData
{
[JsonProperty(PropertyName = "Maximum number of players")]
public int ServerMaxplayers { get; set; }
[JsonProperty(PropertyName = "Bears per square kilometer")]
public int BearPopulation { get; set; }
[JsonProperty(PropertyName = "Polarbears per square kilometer")]
public int PolarbearPopulation { get; set; }
[JsonProperty(PropertyName = "Chickens per square kilometer")]
public int ChickenPopulation { get; set; }
[JsonProperty(PropertyName = "Stags per square kilometer")]
public int StagPopulation { get; set; }
[JsonProperty(PropertyName = "Boars per square kilometer")]
public int BoarPopulation { get; set; }
[JsonProperty(PropertyName = "Wolves per square kilometer")]
public int WolfPopulation { get; set; }
[JsonProperty(PropertyName = "Horses per square kilometer (Not ridable, easy prey)")]
public int HorsePopulation { get; set; }
[JsonProperty(PropertyName = "Ridable horses per square kilometer")]
public int RidablehorsePopulation { get; set; }
[JsonProperty(PropertyName = "Motorbike population in monuments")]
public int BikeMotorbikemonumentpopulation { get; set; }
[JsonProperty(PropertyName = "Pedal bike population in monuments")]
public int BikePedalmonumentpopulation { get; set; }
[JsonProperty(PropertyName = "Pedal bike population active on the server (Roadside spawns)")]
public int BikePedalroadsidepopulation { get; set; }
[JsonProperty(PropertyName = "Modular cars population")]
public int ModularcarPopulation { get; set; }
[JsonProperty(PropertyName = "Motor rowboat population")]
public int MotorrowboatPopulation { get; set; }
[JsonProperty(PropertyName = "RHIB population")]
public int RhibRhibpopulation { get; set; }
[JsonProperty(PropertyName = "Hot air balloon population")]
public int HotairballoonPopulation { get; set; }
[JsonProperty(PropertyName = "Minicopter population")]
public int MinicopterPopulation { get; set; }
[JsonProperty(PropertyName = "Scrap transport helicopter population")]
public int ScraptransporthelicopterPopulation { get; set; }
[JsonProperty(PropertyName = "Traincar population")]
public int TraincarPopulation { get; set; }
[JsonProperty(PropertyName = "Scarecrow population")]
public int HalloweenScarecrowpopulation { get; set; }
[JsonProperty(PropertyName = "Murder population (The same as Scarecrow)")]
public int HalloweenMurdererpopulation { get; set; }
[JsonProperty(PropertyName = "Zombie population (Outdated broken zombies)")]
public int ZombiePopulation { get; set; }
[JsonProperty(PropertyName = "Halloween portal population")]
public int HalloweendungeonPopulation { get; set; }
[JsonProperty(PropertyName = "Xmas portal population")]
public int XmasdungeonXmaspopulation { get; set; }
[JsonProperty(PropertyName = "Metaldetector points population (Default 1200)")]
public int MetaldetectorsourcePopulation { get; set; }
[JsonProperty(PropertyName = "Snake population")]
public int SnakehazardPopulation { get; set; }
[JsonProperty(PropertyName = "Panther population")]
public int PantherPopulation { get; set; }
[JsonProperty(PropertyName = "Tiger population")]
public int TigerPopulation { get; set; }
[JsonProperty(PropertyName = "Crocodile population")]
public int CrocodilePopulation { get; set; }
}
protected override void LoadDefaultConfig()
{
ConfigData defaultConfig = new ConfigData
{
ServerMaxplayers = 100,
BearPopulation = 2,
PolarbearPopulation = 1,
ChickenPopulation = 3,
StagPopulation = 3,
BoarPopulation = 5,
WolfPopulation = 4,
HorsePopulation = 0,
RidablehorsePopulation = 2,
BikeMotorbikemonumentpopulation = 1,
BikePedalmonumentpopulation = 1,
BikePedalroadsidepopulation = 1,
ModularcarPopulation = 3,
MotorrowboatPopulation = 1,
RhibRhibpopulation = 0,
HotairballoonPopulation = 1,
MinicopterPopulation = 0,
ScraptransporthelicopterPopulation = 0,
TraincarPopulation = 2,
HalloweenScarecrowpopulation = 0,
HalloweenMurdererpopulation = 0,
ZombiePopulation = 0,
HalloweendungeonPopulation = 0,
XmasdungeonXmaspopulation = 0,
MetaldetectorsourcePopulation = 1200,
SnakehazardPopulation = 5,
PantherPopulation = 1,
TigerPopulation = 1,
CrocodilePopulation = 1
};
Config.WriteObject(defaultConfig, true);
}
private void LoadConfig()
{
config = Config.ReadObject<ConfigData>();
}
void OnServerInitialized(bool initial)
{
LoadConfig();
Server.Command("server.maxplayers", config.ServerMaxplayers);
Server.Command("bear.population", config.BearPopulation);
Server.Command("polarbear.population", config.PolarbearPopulation);
Server.Command("chicken.population", config.ChickenPopulation);
Server.Command("stag.population", config.StagPopulation);
Server.Command("boar.population", config.BoarPopulation);
Server.Command("wolf.population", config.WolfPopulation);
Server.Command("horse.population", config.HorsePopulation);
Server.Command("ridablehorse.population", config.RidablehorsePopulation);
Server.Command("bike.motorbikemonumentpopulation", config.BikeMotorbikemonumentpopulation);
Server.Command("bike.pedalmonumentpopulation", config.BikePedalmonumentpopulation);
Server.Command("bike.pedalroadsidepopulation", config.BikePedalroadsidepopulation);
Server.Command("modularcar.population", config.ModularcarPopulation);
Server.Command("motorrowboat.population", config.MotorrowboatPopulation);
Server.Command("rhib.rhibpopulation", config.RhibRhibpopulation);
Server.Command("hotairballoon.population", config.HotairballoonPopulation);
Server.Command("minicopter.population", config.MinicopterPopulation);
Server.Command("scraptransporthelicopter.population", config.ScraptransporthelicopterPopulation);
Server.Command("traincar.population", config.TraincarPopulation);
Server.Command("halloween.scarecrowpopulation", config.HalloweenScarecrowpopulation);
Server.Command("halloween.murdererpopulation", config.HalloweenMurdererpopulation);
Server.Command("zombie.population", config.ZombiePopulation);
Server.Command("halloweendungeon.population", config.HalloweendungeonPopulation);
Server.Command("xmasdungeon.xmaspopulation", config.XmasdungeonXmaspopulation);
Server.Command("metaldetectorsource.population", config.MetaldetectorsourcePopulation);
Server.Command("snakehazard.population", config.SnakehazardPopulation);
Server.Command("panther.population", config.PantherPopulation);
Server.Command("tiger.population", config.TigerPopulation);
Server.Command("crocodile.population", config.CrocodilePopulation);
}
}
}