source: binary-improvements/7dtd-server-fixes/src/CustomCommands/ListPlayersExtended.cs@ 207

Last change on this file since 207 was 206, checked in by alloc, 10 years ago

fixes

File size: 1.0 KB
RevLine 
[75]1using System;
2using System.Collections.Generic;
3
[130]4namespace AllocsFixes.CustomCommands
[75]5{
[206]6 public class ListPlayerIds : ConsoleCommand
[103]7 {
[206]8 public ListPlayerIds (ConsoleSdtd cons) : base(cons)
[130]9 {
10 }
[75]11
[130]12 public override string Description ()
13 {
[206]14 return "lists all players with their IDs for ingame commands";
[130]15 }
[75]16
[130]17 public override string[] Names ()
18 {
[206]19 return new string[] { "listplayerids", "lpi" };
[130]20 }
[75]21
[130]22 public override void Run (string[] _params)
23 {
24 try {
25 World w = CommonMappingFunctions.GetGameManager ().World;
26 int num = 0;
27 foreach (KeyValuePair<int, EntityPlayer> current in w.playerEntities.dict) {
28 m_Console.SendResult (string.Concat (new object[]
[144]29 {
30 string.Empty,
31 ++num,
32 ". id=",
[206]33 current.Value.entityId,
[144]34 ", ",
35 current.Value.EntityName,
36 }
[130]37 )
38 );
39 }
40 m_Console.SendResult ("Total of " + w.playerEntities.list.Count + " in the game");
41 } catch (Exception e) {
[206]42 Log.Out ("Error in ListPlayerIds.Run: " + e);
[103]43 }
[75]44 }
45 }
46}
Note: See TracBrowser for help on using the repository browser.