source: binary-improvements/7dtd-server-fixes/src/TelnetCommands/ListPlayersExtended.cs@ 112

Last change on this file since 112 was 107, checked in by alloc, 10 years ago

fixes

File size: 1.6 KB
Line 
1using System;
2using System.Collections.Generic;
3
4public class ListPlayersExtended : ConsoleCommand
5{
6 public ListPlayersExtended (ConsoleSdtd cons) : base(cons)
7 {
8 }
9
10 public override string Description ()
11 {
12 return "lists all players with extended attributes";
13 }
14
15 public override string[] Names ()
16 {
17 return new string[] { "listplayersextended", "lpe" };
18 }
19
20 public override void Run (string[] _params)
21 {
22 try {
23 World w = CommonMappingFunctions.GetGameManager ().World;
24 int num = 0;
25 foreach (KeyValuePair<int, EntityPlayer> current in w.playerEntities.dict) {
26 ClientInfo ci = CommonMappingFunctions.GetClientInfoFromEntityID (current.Key);
27 string ip = string.Empty;
28 if (ci != null) {
29 ip = ci.networkPlayer.ipAddress;
30 }
31 m_Console.SendResult (string.Concat (new object[]
32 {
33 string.Empty,
34 ++num,
35 ". id=",
36 current.Value.fd0087,
37 ", ",
38 current.Value.EntityName,
39 ", pos=",
40 current.Value.GetPosition (),
41 ", rot=",
42 current.Value.rotation,
43 ", remote=",
44 current.Value.fd00aa,
45 ", health=",
46 current.Value.Health,
47 ", deaths=",
48 current.Value.Died,
49 ", zombies=",
50 current.Value.KilledZombies,
51 ", players=",
52 current.Value.KilledPlayers,
53 ", score=",
54 current.Value.Score,
55 ", steamid=",
56 CommonMappingFunctions.GetSteamID (ci),
57 ", ip=",
58 ip,
59 ", ping=",
60 current.Value.pingToServer
61 }
62 )
63 );
64 }
65 m_Console.SendResult ("Total of " + w.playerEntities.list.Count + " in the game");
66 } catch (Exception e) {
67 Log.Out ("Error in ListPlayersExtended.Run: " + e);
68 }
69 }
70}
71
Note: See TracBrowser for help on using the repository browser.