Rev | Line | |
---|
[196] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 |
|
---|
| 4 | namespace AllocsFixes.CustomCommands
|
---|
| 5 | {
|
---|
| 6 | public class Unban : ConsoleCommand
|
---|
| 7 | {
|
---|
| 8 | public Unban (ConsoleSdtd cons) : base(cons)
|
---|
| 9 | {
|
---|
| 10 | }
|
---|
| 11 |
|
---|
| 12 | public override string Description ()
|
---|
| 13 | {
|
---|
| 14 | return "unban a player";
|
---|
| 15 | }
|
---|
| 16 |
|
---|
| 17 | public override string[] Names ()
|
---|
| 18 | {
|
---|
| 19 | return new string[] { "unban", string.Empty };
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | public override void Run (string[] _params)
|
---|
| 23 | {
|
---|
| 24 | try {
|
---|
| 25 | if (_params.Length != 1) {
|
---|
| 26 | m_Console.SendResult ("Usage: unban <steamid>");
|
---|
| 27 | return;
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | long tempLong;
|
---|
| 31 | if (_params [0].Length != 17 || !long.TryParse (_params [0], out tempLong)) {
|
---|
| 32 | m_Console.SendResult ("Not a valid Steam ID.");
|
---|
| 33 | return;
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | AdminTools at = CommonMappingFunctions.GetGameManager ().adminTools;
|
---|
| 37 | if (!at.isBanned (_params [0])) {
|
---|
| 38 | m_Console.SendResult ("Steam ID is not banned.");
|
---|
| 39 | return;
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | at.RemoveBan (_params [0]);
|
---|
| 43 | m_Console.SendResult ("Removed ban for Steam ID " + _params [0]);
|
---|
| 44 | } catch (Exception e) {
|
---|
| 45 | Log.Out ("Error in Unban.Run: " + e);
|
---|
| 46 | }
|
---|
| 47 | }
|
---|
| 48 | }
|
---|
| 49 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.