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

Last change on this file since 192 was 164, checked in by alloc, 10 years ago

fixes - untested

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