Hey there,
i need help to save and a configurations for players inventory
config eg:
inventorys {
UserID {
maininventory {
items {
itemshortname: xxx,
itemamount: xxx,
itemskin: xxx
}
}
beltinventory {
....
But i dont know how to do it. I know how to save simple config eg config["name"] = ""; but i dont know how to handle it with multidimensional arrays
Can everybody help me?
C# Config multidimensional array
Discussion in 'Rust Development' started by Sir BenSon, Nov 22, 2016.
-
Er. If you wanted to save a players inventory itself I would just do a data file.
You can find more examples in some of my plugins, but here is a little example:
I kinda had to quick rush this example but if you need it im sure I can provide you with a better one.Code:static StoredData storedData; class StoredData { public Dictionary<ulong, InvData> iData = new Dictionary<ulong, InvData>(); }class InvData { public ulong UserID; public Dictionary<int, ItemData> itemD = new Dictionary<int, ItemData>(); }class ItemData { public string itemshortname; public int itemamount; pubic int itemskin; }
[DOUBLEPOST=1479838810][/DOUBLEPOST]And now I that I think of it, event managers has a pretty effective way of saving inventory data. Go check @k1lly0u 's event manager plugin.
Event Manager for Rust | Oxide -
tryCode:
protected override void LoadDefaultConfig() { var Default = new Dictionary<string, object> { }; Default.Add("ChatName", "Running Man"); Default.Add("authLevel", 2); Default.Add("Count", 5); this.Config["Default"] = Default; }
Code:protected override void LoadDefaultConfig() { var UserID= new Dictionary<string, object> { }; var maininventory= new Dictionary<string, object> { }; var items= new Dictionary<string, object> { }; items.Add("itemshortname", "ololo"); items.Add("itemamount", "azaza"); items.Add("itemskin", "mamky ebal"); maininventory.Add("items", items); UserID.Add("maininventory", maininventory); this.Config["inventorys"] = UserID; }Last edited by a moderator: Nov 23, 2016
