1. So i'm trying to do something like a Point counter..

    The code that i will show you below prints something like:
    Code:
    Person3
    Person2
    Person1
    69
    70
    71
    
    Code:
    Code:
                int[] values = sth.Values.ToArray();
                string[] keys = sth.Keys.ToArray();
                Array.Sort(values, keys);
                foreach(string key in keys)
                Puts(key.ToString());
                foreach(int num in values)
                Puts(num.ToString());
    
    What i cant do and I've been searching for hours is.. to connect these two arrays into a one string.

    Thanks for any help,
    PaiN
     
  2. What type of output string are you trying to form?
    Something like:

    Person3: 69,
    Person2: 70,
    Person1: 72
     
  3. Yes exactly this ;)
     
  4. Code:
    Dictionary<string, int> sth = new Dictionary<string, int>()
        {
            { "Person 1", 69},
            { "Person 2", 70},
            { "Person 3", 72}
        };foreach(KeyValuePair<string, int> entry in sth)
    {
        Puts($"{entry.Key}:{entry.Value}");
    }
     
  5. Yeah .. and what i want is to make a list with top3 "points" dunno how to call it. With Array.Sort I've managed to sort random values ex. {30, 40, 25, 100} from the higher number to lower and the Key of it with the code that i will show you below.
    100
    40
    30
    25
    Code:
    class Test : RustPlugin 
        {
            public Dictionary<string, int> sth = new Dictionary<string, int>();
            void Loaded()
            {           
                sth.Add("Person2", 55);
                sth.Add("Person3", 50);
                sth.Add("Person1", 71);
            }       
            [ConsoleCommand("test.test")]
            void cmdTestT(ConsoleSystem.Arg arg) 
            {
                int[] values = sth.Values.ToArray();
                string[] keys = sth.Keys.ToArray();
                //Array array = players;
                Array.Sort(keys, values);
                foreach(string key in keys)
                Puts(key.ToString());
                foreach(int num in values)
                Puts(num.ToString());
            }
        }
    Once i type Test It shows: Check this screenshot! (Click it)
    How would i do these 2 seperated (Key & Value) into a one string ?
     
  6. Code:
    Dictionary<string, int> sth = new Dictionary<string, int>()
        {
            { "Person 1", 69},
            { "Person 2", 70},
            { "Person 3", 72}
        };
    var sortedDict = from entry in sth orderby entry.Value descending select entry;
    foreach(KeyValuePair<string, int> entry in sortedDict)
    {
        Puts($"{entry.Key}:{entry.Value}");
    }
    Puts(string.Join(",", sortedDict.Select(x => x.Key + ":" + x.Value)));
    Person 3:72
    Person 2:70
    Person 1:69
    Person 3:72,Person 2:70,Person 1:69
     
  7. Thank you ;)