That is part of my config file, so I'd doCode:Config["RespawnMessage"] = new List<string> { "Hey, <color=#cd422b>try not to die</color> this time!", "Line 2", "Line 3" };Reference: Unity - Lists and DictionariesCode:SendReply(???);
Pulling from a list in config?
Discussion in 'Rust Development' started by Kappasaurus, Nov 16, 2016.
-
I would set it as an object then do something like this to access it easier.
Code:List<object> RespawnMessage = (List<object>)Config["RespawnMessage"];
-
I'm still confused what part to send to the player.Code:
SendReply(List<object> RespawnMessage);
[DOUBLEPOST=1479301750][/DOUBLEPOST] -
Kinda look around here if you are still having a few issues: Using arrays in Config C# | Oxide
-
SendReply(RespawnMessage);
Since you are calling it as a List of type <object> make sure that it is also that in your config. -
You probably want to do something like this, i suppose?
Code:var msgList = (List<string>) Config["RespawnMessage"]; .... SendReply(player, msgList[Random.Range(msgList.Count)]); -
Thanks for the replies, I'll test them and mark this thread appropriately when I get my internet turned back on.
