Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions Essentials/Commands/AdminModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,25 @@ public void ListPlayers()
return;
}
StringBuilder sb = new StringBuilder();
foreach(var player in MySession.Static.Players.GetOnlinePlayers())
var players = MySession.Static.Players.GetOnlinePlayers();
if (players.Count == 0)
{
Context.Respond("No Players Online");
return;
}

sb.AppendLine($"Found {players.Count} Players on server");
foreach(var player in players)
{
sb.AppendLine();
sb.AppendLine($"{player.DisplayName}");
sb.AppendLine($">PlayerId: {player.Identity.IdentityId}");
sb.AppendLine($">SteamId: {player.Id.SteamId}");
}
if (Context.Player == null)
Context.Respond(sb.ToString());
else if (Context?.Player?.SteamUserId > 0)
{
ModCommunication.SendMessageTo(new DialogMessage("List of Online Players", null, sb.ToString()), Context.Player.SteamUserId);
ModCommunication.SendMessageTo(new DialogMessage("List of Online Players", $"{players.Count} players Online", sb.ToString()), Context.Player.SteamUserId);
}
}

Expand Down