Saving to a configuration file?Solved
good morning

i am struggling to save to my config file i am still learming
i am trying to save the City_string to config could any one help please

[ChatCommand("setcity")]
        void set_city(BasePlayer player, string command, string[] args)
        {
            if (permission.UserHasPermission(player.userID.ToString(), "TeleportTown.set"))
            {

                Puts(player.displayName + " has set City at " + player.transform.position.ToString());
                Vector3 citypocation = player.transform.position;
                string City_string = JsonConvert.SerializeObject(citypocation);

                SaveConfig();
                Puts(City_string);
                player.ChatMessage("City now Set To" + City_string);
            }
            else
            {
                player.ChatMessage("Your Not a Admin");
            } 
        }​

config json

[JsonProperty("city")]
            public List<string> citylocation { get;  set; } =  new List<string>();
Take a look at my plugins with configuration, I use a similar thingy.
is there any you would recommend for a beginner lol
5b6ed4c9ac8e4.jpg misticos
Take a look at my plugins with configuration, I use a similar thingy.

thank you what a simple little code
_config.citylocation = city_string;
SaveConfig()
was all i needed after all lol


Locked automatically