source: binary-improvements/7dtd-server-fixes/src/CustomCommands/ListPlayerIds.cs@ 215

Last change on this file since 215 was 208, checked in by alloc, 10 years ago

fixes

File size: 1.0 KB
Line 
1using System;
2using System.Collections.Generic;
3
4namespace AllocsFixes.CustomCommands
5{
6 public class ListPlayerIds : ConsoleCommand
7 {
8 public ListPlayerIds (ConsoleSdtd cons) : base(cons)
9 {
10 }
11
12 public override string Description ()
13 {
14 return "lists all players with their IDs for ingame commands";
15 }
16
17 public override string[] Names ()
18 {
19 return new string[] { "listplayerids", "lpi" };
20 }
21
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[]
29 {
30 string.Empty,
31 ++num,
32 ". id=",
33 current.Value.entityId,
34 ", ",
35 current.Value.EntityName,
36 }
37 )
38 );
39 }
40 m_Console.SendResult ("Total of " + w.playerEntities.list.Count + " in the game");
41 } catch (Exception e) {
42 Log.Out ("Error in ListPlayerIds.Run: " + e);
43 }
44 }
45 }
46}
Note: See TracBrowser for help on using the repository browser.