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