Changeset 278 for binary-improvements
- Timestamp:
- May 24, 2016, 10:54:25 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/AllocsCommands/Commands/ListKnownPlayers.cs
r238 r278 17 17 " 2. listknownplayers -online\n" + 18 18 " 3. listknownplayers -notbanned\n" + 19 " 4. listknownplayers <player name >\n" +19 " 4. listknownplayers <player name / steamid>\n" + 20 20 "1. Lists all players that have ever been online\n" + 21 21 "2. Lists only the players that are currently online\n" + 22 22 "3. Lists only the players that are not banned\n" + 23 "4. Lists all players whose name contains the given string";23 "4. Lists all players whose name contains the given string or matches the given SteamID"; 24 24 } 25 25 … … 37 37 bool notBannedOnly = false; 38 38 string nameFilter = string.Empty; 39 bool isSteamId = false; 39 40 40 41 if (_params.Count == 1) { 42 long steamid = -1; 41 43 if (_params [0].ToLower ().Equals ("-online")) { 42 44 onlineOnly = true; 43 45 } else if (_params [0].ToLower ().Equals ("-notbanned")) { 44 46 notBannedOnly = true; 47 } else if (_params [0].Length == 17 && long.TryParse (_params [0], out steamid)) { 48 isSteamId = true; 45 49 } else { 46 50 nameFilter = _params [0].ToLower (); … … 48 52 } 49 53 50 int num = 0; 51 foreach (string sid in PersistentContainer.Instance.Players.SteamIDs) { 52 Player p = PersistentContainer.Instance.Players [sid, false]; 54 if (isSteamId) { 55 Player p = PersistentContainer.Instance.Players [nameFilter, false]; 53 56 54 if ( 55 (!onlineOnly || p.IsOnline) 56 && (!notBannedOnly || !admTools.IsBanned (sid)) 57 && (nameFilter.Length == 0 || p.Name.ToLower ().Contains (nameFilter)) 58 ) { 57 if (p != null) { 59 58 SdtdConsole.Instance.Output (String.Format ("{0}. {1}, id={2}, steamid={3}, online={4}, ip={5}, playtime={6} m, seen={7}", 60 ++num, p.Name, p.EntityID, sid, p.IsOnline, p.IP,61 62 59 0, p.Name, p.EntityID, nameFilter, p.IsOnline, p.IP, 60 p.TotalPlayTime / 60, 61 p.LastOnline.ToString ("yyyy-MM-dd HH:mm")) 63 62 ); 63 } else { 64 SdtdConsole.Instance.Output (String.Format ("SteamID {0} unknown!", nameFilter)); 64 65 } 66 } else { 67 int num = 0; 68 foreach (string sid in PersistentContainer.Instance.Players.SteamIDs) { 69 Player p = PersistentContainer.Instance.Players [sid, false]; 70 71 if ( 72 (!onlineOnly || p.IsOnline) 73 && (!notBannedOnly || !admTools.IsBanned (sid)) 74 && (nameFilter.Length == 0 || p.Name.ToLower ().Contains (nameFilter)) 75 ) { 76 SdtdConsole.Instance.Output (String.Format ("{0}. {1}, id={2}, steamid={3}, online={4}, ip={5}, playtime={6} m, seen={7}", 77 ++num, p.Name, p.EntityID, sid, p.IsOnline, p.IP, 78 p.TotalPlayTime / 60, 79 p.LastOnline.ToString ("yyyy-MM-dd HH:mm")) 80 ); 81 } 82 } 83 SdtdConsole.Instance.Output ("Total of " + PersistentContainer.Instance.Players.Count + " known"); 65 84 } 66 SdtdConsole.Instance.Output ("Total of " + PersistentContainer.Instance.Players.Count + " known");67 85 } catch (Exception e) { 68 86 Log.Out ("Error in ListKnownPlayers.Run: " + e);
Note:
See TracChangeset
for help on using the changeset viewer.