To get a list of online players, we'll be using Provider which will contain the information of our players.
Here's a code snippet of getting our list of players:
Code: Select all
string list = ""; int i = 0;
foreach (SteamPlayer plr in Provider.Players)
//So let's convert each SteamPlayer into an UnturnedPlayer
UnturnedPlayer unturnedPlayer = UnturnedPlayer.FromSteamPlayer(plr);
//Now let's heal everyone!
unturnedPlayer.Heal(100, false, false);
//Now let's keep a list of each player so we can say who's online!
if (i != Provider.Players.Count)
list += unturnedPlayer.CharacterName + ", ";
list += unturnedPlayer.CharacterName + ".";
UnturnedChat.Say("Players online: " + list, Color.yellow);
//And why not show a status of players online from the max amount allowed online! :D
UnturnedChat.Say(Provider.Players.Count + "/" + Provider.maxPlayers, Color.green);
Read the comments to hopefully get a better understanding of what's going on.
I hope this helped out, and if there's any tutorials needed, feel free to ask!
Kind regards - LeeIzaZombie.