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

Last change on this file since 93 was 91, checked in by alloc, 10 years ago

fixes

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