1. Hi!
    I need to get random steamid from players.
    I dont know how to use this:

    Code:
            void getRandomPlayer(PlayerSession player, NetworkPlayer n)
            {
                Player.Sessions.Random(n, player);
            }
     
    Last edited by a moderator: May 30, 2017
  2. Hello @5311,
    What do you exactly want?
    You want a random steam id out of all online players?
     
  3. @Mr. Blue
    Yes I need get random steamid out of all online players.
     
  4. Hi @5311,
    I think this should do...
    Code:
    void getRandomPlayerId()
            {
                var allPlayers = GameManager.Instance.GetSessions().Values.ToList();
                if (allPlayers.Count() > 0)
                {
                    int randomInt = UnityEngine.Random.Range(0, allPlayers.Count());
                    var playerId = allPlayers[randomInt].SteamId.ToString();
                    Puts("RANDOM: " + playerId);
                }
                else
                {
                    Puts("No online players");
                }
            }
     
    Last edited by a moderator: May 30, 2017
  5. Thanks!!