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

Last change on this file since 160 was 144, checked in by alloc, 10 years ago

Fixes

File size: 1.7 KB
RevLine 
[75]1using System;
2using System.Collections.Generic;
3
[130]4namespace AllocsFixes.CustomCommands
[75]5{
[130]6 public class ListPlayersExtended : ConsoleCommand
[103]7 {
[130]8 public ListPlayersExtended (ConsoleSdtd cons) : base(cons)
9 {
10 }
[75]11
[130]12 public override string Description ()
13 {
14 return "lists all players with extended attributes";
15 }
[75]16
[130]17 public override string[] Names ()
18 {
19 return new string[] { "listplayersextended", "lpe" };
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 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[]
[144]34 {
35 string.Empty,
36 ++num,
37 ". id=",
38 current.Value.fd008f,
39 ", ",
40 current.Value.EntityName,
41 ", pos=",
42 current.Value.GetPosition (),
43 ", rot=",
44 current.Value.rotation,
45 ", remote=",
46 current.Value.fd00b2,
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 }
[130]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);
[103]70 }
[75]71 }
72 }
73}
Note: See TracBrowser for help on using the repository browser.