Esempio n. 1
0
        void cmdDropUser(ConsoleSystem.Arg arg)
        {
            if (arg.Connection != null)
            {
                return;
            }
            ulong userId = arg.GetUInt64(0);

            CasePlayer casePlayer;

            if (!players.TryGetValue(userId, out casePlayer))
            {
                Puts("У игрока нет кейсов!");
                return;
            }

            var commandMsg = $"randomcasegive {userId}";

            foreach (var ccase in casePlayer.Inventory)
            {
                commandMsg += $" \"{ccase}\" 1";
            }
            foreach (var ccase in casePlayer.CasesQueue)
            {
                commandMsg += $" \"{ccase.Type}\" {ccase.Amount - 1}";
            }

            players.Remove(userId);
            Puts($"Очищены кейсы {userId}\nДля переноса используйте следующую команду:\n{commandMsg}");
        }
Esempio n. 2
0
        private void BanID(ConsoleSystem.Arg args)
        {
            ulong  steamID = args.GetUInt64(0, 0uL);
            string name    = args.GetString(1, "unnamed");
            string reason  = args.GetString(2, "no reason");

            if (steamID == 0)
            {
                return;
            }

            var user = ServerUsers.Get(steamID);

            if (user != null)
            {
                if (UsernameValid(steamID, name))
                {
                    name = user.username;
                }
            }
            user.group = ServerUsers.UserGroup.Banned;

            if (Settings.Instance.PushedAllLocalBansToDatabase)
            {
                PushBansToServer();
            }
        }
Esempio n. 3
0
        private void OnConsoleCommandTeleport(ConsoleSystem.Arg arg)
        {
            if (arg.Connection == null || arg.Connection.player == null || !arg.HasArgs())
            {
                return;
            }

            BasePlayer player = (BasePlayer)arg.Connection.player;

            switch (arg.GetString(0))
            {
            case "home":
                switch (arg.GetString(1))
                {
                case "close":
                    DestroyHomeUI(player);
                    break;

                case "add":
                    AddHome(player, arg.GetString(2, "1"));
                    break;

                case "remove":
                    DeleteHome(player, arg.GetString(2, "1"));
                    break;

                case "teleport":
                    TeleportHome(player, arg.GetString(2, "1"));
                    DestroyHomeUI(player);
                    break;

                case "index":
                    UpdateHomeUI(player, arg.GetInt(2, 0));
                    break;
                }
                break;

            case "tpr":
                switch (arg.GetString(1))
                {
                case "close":
                    DestroyTprUI(player);
                    break;

                case "request":
                    DestroyTprUI(player);
                    BasePlayer target = Helper.FindPlayerById(arg.GetUInt64(2));
                    if (target != null)
                    {
                        TeleportRequest(player, target);
                    }
                    break;

                case "index":
                    UpdateTprUI(player, BasePlayer.activePlayerList, arg.GetInt(2, 0));
                    break;
                }
                break;
            }
        }
Esempio n. 4
0
        public static void @add(ConsoleSystem.Arg args)
        {
            BasePlayer basePlayer = args.Player();

            if (!basePlayer)
            {
                return;
            }
            if (basePlayer.IsDead())
            {
                return;
            }
            int num  = args.GetInt(0, 0);
            int num1 = args.GetInt(1, 1);
            int num2 = (int)args.GetUInt64(2, (ulong)0);

            if (num1 < 1)
            {
                return;
            }
            ItemDefinition itemDefinition = ItemManager.FindItemDefinition(num);

            if (itemDefinition == null)
            {
                args.ReplyWith("Item not found");
                return;
            }
            ItemBlueprint itemBlueprint = ItemManager.FindBlueprint(itemDefinition);

            if (!itemBlueprint)
            {
                args.ReplyWith("Blueprint not found");
                return;
            }
            if (!itemBlueprint.userCraftable)
            {
                args.ReplyWith("Item is not craftable");
                return;
            }
            if (!basePlayer.blueprints.CanCraft(num, num2))
            {
                num2 = 0;
                if (!basePlayer.blueprints.CanCraft(num, num2))
                {
                    args.ReplyWith("You can't craft this item");
                    return;
                }
                args.ReplyWith("You don't have permission to use this skin, so crafting unskinned");
            }
            if (basePlayer.inventory.crafting.CraftItem(itemBlueprint, basePlayer, null, num1, num2, null))
            {
                return;
            }
            args.ReplyWith("Couldn't craft!");
        }
Esempio n. 5
0
        public static void skipqueue(ConsoleSystem.Arg arg)
        {
            ulong num = arg.GetUInt64(0, (ulong)0);

            if (num >= 70000000000000000L)
            {
                SingletonComponent <ServerMgr> .Instance.connectionQueue.SkipQueue(num);

                return;
            }
            arg.ReplyWith(string.Concat("This doesn't appear to be a 64bit steamid: ", num));
        }
Esempio n. 6
0
        public static void add(ConsoleSystem.Arg args)
        {
            BasePlayer owner = args.Player();

            if (!Object.op_Implicit((Object)owner) || owner.IsDead())
            {
                return;
            }
            int num1   = args.GetInt(0, 0);
            int amount = args.GetInt(1, 1);
            int num2   = (int)args.GetUInt64(2, 0UL);

            if (amount < 1)
            {
                return;
            }
            ItemDefinition itemDefinition = ItemManager.FindItemDefinition(num1);

            if (Object.op_Equality((Object)itemDefinition, (Object)null))
            {
                args.ReplyWith("Item not found");
            }
            else
            {
                ItemBlueprint blueprint = ItemManager.FindBlueprint(itemDefinition);
                if (!Object.op_Implicit((Object)blueprint))
                {
                    args.ReplyWith("Blueprint not found");
                }
                else if (!blueprint.userCraftable)
                {
                    args.ReplyWith("Item is not craftable");
                }
                else
                {
                    if (!owner.blueprints.CanCraft(num1, num2))
                    {
                        num2 = 0;
                        if (!owner.blueprints.CanCraft(num1, num2))
                        {
                            args.ReplyWith("You can't craft this item");
                            return;
                        }
                        args.ReplyWith("You don't have permission to use this skin, so crafting unskinned");
                    }
                    if (owner.inventory.crafting.CraftItem(blueprint, owner, (Item.InstanceData)null, amount, num2, (Item)null))
                    {
                        return;
                    }
                    args.ReplyWith("Couldn't craft!");
                }
            }
        }
Esempio n. 7
0
        public static void skipqueue(ConsoleSystem.Arg arg)
        {
            ulong uint64 = arg.GetUInt64(0, 0UL);

            if (uint64 < 70000000000000000UL)
            {
                arg.ReplyWith("This doesn't appear to be a 64bit steamid: " + (object)uint64);
            }
            else
            {
                ((ServerMgr)SingletonComponent <ServerMgr> .Instance).connectionQueue.SkipQueue(uint64);
            }
        }
Esempio n. 8
0
        private void Unban(ConsoleSystem.Arg args)
        {
            ulong steamID = args.GetUInt64(0, 0uL);

            if (steamID < 70000000000000000uL)
            {
                return;
            }
            var query = string.Format(MySqlConstants.REMOVE_BAN, Settings.Instance.DatabaseName, Settings.Instance.TableName, steamID);

            PerformDatabaseQuery(query, (responseRows) =>
            {
            });
        }
Esempio n. 9
0
        public static void cheatreport(ConsoleSystem.Arg arg)
        {
            BasePlayer basePlayer = arg.Player();

            if (basePlayer == null)
            {
                return;
            }
            ulong  num = arg.GetUInt64(0, (ulong)0);
            string str = arg.GetString(1, "");

            UnityEngine.Debug.LogWarning(string.Concat(new object[] { basePlayer, " reported ", num, ": ", str.ToPrintable(140) }));
            EACServer.eacScout.SendPlayerReport(num.ToString(), basePlayer.net.connection.userid.ToString(), PlayerReportCategory.PlayerReportCheating, str);
        }
Esempio n. 10
0
        public static void cheatreport(ConsoleSystem.Arg arg)
        {
            BasePlayer basePlayer = arg.Player();

            if (Object.op_Equality((Object)basePlayer, (Object)null))
            {
                return;
            }
            ulong  uint64 = arg.GetUInt64(0, 0UL);
            string str    = arg.GetString(1, "");

            Debug.LogWarning((object)(basePlayer.ToString() + " reported " + (object)uint64 + ": " + StringEx.ToPrintable(str, 140)));
            // ISSUE: explicit non-virtual call
            EACServer.eacScout.SendPlayerReport(uint64.ToString(), __nonvirtual(basePlayer.net.get_connection().userid.ToString()), (PlayerReportCategory)1, str);
        }
Esempio n. 11
0
    public static void ClearCassettesByUser(ConsoleSystem.Arg arg)
    {
        ulong uInt = arg.GetUInt64(0, 0uL);
        int   num  = 0;

        foreach (BaseNetworkable serverEntity in BaseNetworkable.serverEntities)
        {
            Cassette cassette;
            if ((object)(cassette = serverEntity as Cassette) != null && cassette.CreatorSteamId == uInt)
            {
                cassette.ClearSavedAudio();
                num++;
            }
        }
        arg.ReplyWith($"Deleted {num} cassettes recorded by {uInt}");
    }
Esempio n. 12
0
        void AddAdminToGroupCommand(ConsoleSystem.Arg arg)
        {
            if (!arg.HasArgs(2))
            {
                arg.ReplyWith("[AdminRestrictions]: Invalid syntax: adminrestrictions.addadmintogroup <group name> <admin steam id>");
                return;
            }

            var groupName = arg.GetString(0, null);

            if (string.IsNullOrWhiteSpace(groupName))
            {
                arg.ReplyWith("[AdminRestrictions]: Invalid syntax: adminrestrictions.addadmintogroup <group name> <admin steam id>");
                return;
            }

            var userId = arg.GetUInt64(1, 0);

            if (userId == 0)
            {
                arg.ReplyWith("[AdminRestrictions]: Invalid syntax: adminrestrictions.addadmintogroup <group name> <admin steam id>");
                return;
            }

            for (int i = 0; i < _configuration.groupConfigs.Length; i++)
            {
                var configGroup = _configuration.groupConfigs[i];
                if (!string.Equals(configGroup.name, groupName))
                {
                    continue;
                }

                if (configGroup.steamIds.Contains(userId))
                {
                    arg.ReplyWith($"[AdminRestrictions]: Admin \"{userId}\" is already apart of the group \"{groupName}\"");
                    return;
                }

                configGroup.steamIds.Add(userId);
                arg.ReplyWith($"[AdminRestrictions]: Added admin \"{userId}\" to group \"{groupName}\"");
                SaveConfiguration();
                return;
            }

            arg.ReplyWith($"[AdminRestrictions]: Failed to find group with name \"{groupName}\"");
        }
Esempio n. 13
0
        public static void unban(ConsoleSystem.Arg arg)
        {
            ulong num = arg.GetUInt64(0, (ulong)0);

            if (num < 70000000000000000L)
            {
                arg.ReplyWith(string.Concat("This doesn't appear to be a 64bit steamid: ", num));
                return;
            }
            ServerUsers.User user = ServerUsers.Get(num);
            if (user == null || user.@group != ServerUsers.UserGroup.Banned)
            {
                arg.ReplyWith(string.Concat("User ", num, " isn't banned"));
                return;
            }
            ServerUsers.Remove(num);
            arg.ReplyWith(string.Concat("Unbanned User: ", num));
        }
Esempio n. 14
0
        public static void banid(ConsoleSystem.Arg arg)
        {
            ulong  num  = arg.GetUInt64(0, (ulong)0);
            string str  = arg.GetString(1, "unnamed");
            string str1 = arg.GetString(2, "no reason");

            if (num < 70000000000000000L)
            {
                arg.ReplyWith(string.Concat("This doesn't appear to be a 64bit steamid: ", num));
                return;
            }
            ServerUsers.User user = ServerUsers.Get(num);
            if (user != null && user.@group == ServerUsers.UserGroup.Banned)
            {
                arg.ReplyWith(string.Concat("User ", num, " is already banned"));
                return;
            }
            ServerUsers.Set(num, ServerUsers.UserGroup.Banned, str, str1);
            arg.ReplyWith(string.Concat(new object[] { "Banned User: "******" - ", str }));
        }
Esempio n. 15
0
        public static void unban(ConsoleSystem.Arg arg)
        {
            ulong uint64 = arg.GetUInt64(0, 0UL);

            if (uint64 < 70000000000000000UL)
            {
                arg.ReplyWith("This doesn't appear to be a 64bit steamid: " + (object)uint64);
            }
            else
            {
                ServerUsers.User user = ServerUsers.Get(uint64);
                if (user == null || user.group != ServerUsers.UserGroup.Banned)
                {
                    arg.ReplyWith("User " + (object)uint64 + " isn't banned");
                }
                else
                {
                    ServerUsers.Remove(uint64);
                    arg.ReplyWith("Unbanned User: " + (object)uint64);
                }
            }
        }
Esempio n. 16
0
    public static void ClearRadioByUser(ConsoleSystem.Arg arg)
    {
        ulong uInt = arg.GetUInt64(0, 0uL);
        int   num  = 0;

        foreach (BaseNetworkable serverEntity in BaseNetworkable.serverEntities)
        {
            DeployableBoomBox deployableBoomBox;
            HeldBoomBox       heldBoomBox;
            if ((object)(deployableBoomBox = serverEntity as DeployableBoomBox) != null)
            {
                if (deployableBoomBox.ClearRadioByUserId(uInt))
                {
                    num++;
                }
            }
            else if ((object)(heldBoomBox = serverEntity as HeldBoomBox) != null && heldBoomBox.ClearRadioByUserId(uInt))
            {
                num++;
            }
        }
        arg.ReplyWith($"Stopped and cleared saved URL of {num} boom boxes");
    }
Esempio n. 17
0
        public static void banid(ConsoleSystem.Arg arg)
        {
            ulong  uint64   = arg.GetUInt64(0, 0UL);
            string username = arg.GetString(1, "unnamed");
            string notes    = arg.GetString(2, "no reason");

            if (uint64 < 70000000000000000UL)
            {
                arg.ReplyWith("This doesn't appear to be a 64bit steamid: " + (object)uint64);
            }
            else
            {
                ServerUsers.User user = ServerUsers.Get(uint64);
                if (user != null && user.group == ServerUsers.UserGroup.Banned)
                {
                    arg.ReplyWith("User " + (object)uint64 + " is already banned");
                }
                else
                {
                    ServerUsers.Set(uint64, ServerUsers.UserGroup.Banned, username, notes);
                    arg.ReplyWith("Banned User: "******" - " + username);
                }
            }
        }
Esempio n. 18
0
            static bool Prefix(ConsoleSystem.Arg arg)
            {
                BasePlayer basePlayer = arg.Player();

                if (basePlayer == null)
                {
                    return(false);
                }

                ulong @uint  = arg.GetUInt64(0, 0UL);
                var   player = BasePlayer.FindByID(@uint);

                if (player == null)
                {
                    return(false);
                }

                if (ShouldIgnore(player.Connection) || ShouldIgnore(basePlayer.Connection))
                {
                    return(false);
                }

                return(true);
            }
        private void OnConsoleCommand(ConsoleSystem.Arg arg)
        {
            if (arg.Connection == null || arg.Connection.player == null || !arg.HasArgs())
            {
                return;
            }

            BasePlayer player = (BasePlayer)arg.Connection.player;

            PlayerData.PData pdata = PlayerData.Get(player);

            if (pdata == null)
            {
                return;
            }

            switch (arg.GetString(0))
            {
            case "index":
                GetFriends(player, players => UpdateUI(player, players, arg.GetInt(1)), true);
                break;

            case "close":
                DestroyUI(player);
                break;

            case "add":
                DestroyUI(player);

                Database.Query(Database.Build("SELECT * FROM users WHERE steam_id=@0 LIMIT 1;", arg.GetUInt64(1)), records =>
                {
                    if (records.Count == 0)
                    {
                        return;
                    }

                    int foundUser     = Convert.ToInt32(records[0]["id"]);
                    ulong foundUserId = Convert.ToUInt64(records[0]["steam_id"]);

                    if (foundUser == pdata.id)
                    {
                        player.ChatMessage("You cannot add yourself to your friendlist.");
                        return;
                    }

                    AddFriend(player, foundUserId, foundUser, result =>
                    {
                        if (result > 0)
                        {
                            player.ChatMessage($"{records[0]["display_name"]} added to your friendlist.");
                        }
                        else if (result == 0)
                        {
                            player.ChatMessage($"{records[0]["display_name"]} is already in your friends list.");
                        }
                        else
                        {
                            player.ChatMessage($"Something went wrong (error code: {result})");
                        }
                    });
                });
                break;

            case "remove":
                DestroyUI(player);

                Database.Query(Database.Build("SELECT * FROM users WHERE steam_id=@0 LIMIT 1;", arg.GetUInt64(1)), records =>
                {
                    if (records.Count == 0)
                    {
                        return;
                    }

                    int foundUser     = Convert.ToInt32(records[0]["id"]);
                    ulong foundUserId = Convert.ToUInt64(records[0]["steam_id"]);

                    if (foundUser == pdata.id)
                    {
                        player.ChatMessage("You cannot remove yourself from your friendlist.");
                        return;
                    }

                    RemoveFriend(player, foundUserId, foundUser, result =>
                    {
                        if (result > 0)
                        {
                            player.ChatMessage($"{records[0]["display_name"]} removed from your friendlist.");
                        }
                        else if (result == 0)
                        {
                            player.ChatMessage($"{records[0]["display_name"]} is not in your friendlist.");
                        }
                        else
                        {
                            player.ChatMessage($"Something went wrong (error code: {result})");
                        }
                    });
                });
                break;
            }
        }
Esempio n. 20
0
        private void ccmdEco(ConsoleSystem.Arg arg)
        {
            if (!arg.HasArgs())
            {
                arg.ReplyWith("Economy Commands: 'eco.c deposit', 'eco.c save','eco.c balance', 'eco.c withdraw', 'eco.c setmoney', 'eco.c wipe'");
                return;
            }
            var player = arg.Player();

            if (player != null && !HasAccess(player))
            {
                arg.ReplyWith("No permission!");
                return;
            }
            var cmdArg = arg.GetString(0).ToLower();

            switch (cmdArg)
            {
            case "save":
                changed = true;
                SaveEconomics();
                arg.ReplyWith("Economics data saved!");
                break;

            case "wipe":
                economicsData = new Dictionary <ulong, double>();
                changed       = true;
                SaveEconomics();
                arg.ReplyWith("Economics data wiped!");
                break;

            case "deposit":
            case "balance":
            case "withdraw":
            case "setmoney":
                var target = FindPlayer(arg.GetString(1));
                if (target == null)
                {
                    arg.ReplyWith($"No user with steam/name: '{arg.GetString(1)}'!");
                    return;
                }
                if (cmdArg.Equals("balance"))
                {
                    arg.ReplyWith($"Balance({target.displayName}) = {GetPlayerMoney(target.userID)}");
                    return;
                }
                double money = arg.GetFloat(2, -1f);
                if (money < 0)
                {
                    money = arg.GetUInt64(2, 0);
                }
                if (money >= 0)
                {
                    if (cmdArg.Equals("setmoney"))
                    {
                        Set(target.userID, money);
                        arg.ReplyWith($"(SetMoney) New '{target.displayName}' balance: {GetPlayerMoney(target.userID)}");
                        PrintMessage(target, "My_Balance", GetPlayerMoney(target.userID));
                    }
                    else if (cmdArg.Equals("deposit"))
                    {
                        Deposit(target.userID, money);
                        arg.ReplyWith($"(Deposit) New '{target.displayName}' balance: {GetPlayerMoney(target.userID)}");
                        PrintMessage(target, "Received", money);
                    }
                    else if (Withdraw(target.userID, money))
                    {
                        arg.ReplyWith($"(Withdraw) New '{target.displayName}' balance: {GetPlayerMoney(target.userID)}");
                        PrintMessage(target, "Lost", money);
                    }
                    else
                    {
                        arg.ReplyWith("This user haven't enough money!");
                    }
                }
                else
                {
                    arg.ReplyWith($"Syntax Error! (eco.c {cmdArg} <steam/name> <money>)");
                }
                break;

            default:
                arg.ReplyWith("Economy Commands: 'eco.c deposit', 'eco.c save','eco.c balance', 'eco.c withdraw', 'eco.c setmoney'");
                break;
            }
        }
Esempio n. 21
0
        public static void stats(ConsoleSystem.Arg arg)
        {
            TextTable table = new TextTable();

            table.AddColumn("id");
            table.AddColumn("name");
            table.AddColumn("time");
            table.AddColumn("kills");
            table.AddColumn("deaths");
            table.AddColumn("suicides");
            table.AddColumn("player");
            table.AddColumn("building");
            table.AddColumn("entity");
            Action <ulong, string> action = (Action <ulong, string>)((id, name) =>
            {
                ServerStatistics.Storage storage = ServerStatistics.Get(id);
                string shortString = TimeSpan.FromSeconds((double)storage.Get("time")).ToShortString();
                string str1        = storage.Get("kill_player").ToString();
                string str2        = (storage.Get("deaths") - storage.Get("death_suicide")).ToString();
                string str3        = storage.Get("death_suicide").ToString();
                string str4        = storage.Get("hit_player_direct_los").ToString();
                string str5        = storage.Get("hit_player_indirect_los").ToString();
                string str6        = storage.Get("hit_building_direct_los").ToString();
                string str7        = storage.Get("hit_building_indirect_los").ToString();
                string str8        = storage.Get("hit_entity_direct_los").ToString();
                string str9        = storage.Get("hit_entity_indirect_los").ToString();
                table.AddRow(new string[9]
                {
                    id.ToString(),
                    name,
                    shortString,
                    str1,
                    str2,
                    str3,
                    str4 + " / " + str5,
                    str6 + " / " + str7,
                    str8 + " / " + str9
                });
            });
            ulong filterID = arg.GetUInt64(0, 0UL);

            if (filterID == 0UL)
            {
                string str1 = arg.GetString(0, "");
                foreach (BasePlayer activePlayer in BasePlayer.activePlayerList)
                {
                    try
                    {
                        if (activePlayer.IsValid())
                        {
                            string str2 = StringExtensions.QuoteSafe(activePlayer.GetSubName(32));
                            if (str1.Length > 0)
                            {
                                if (!StringEx.Contains(str2, str1, CompareOptions.IgnoreCase))
                                {
                                    continue;
                                }
                            }
                            action(activePlayer.userID, str2);
                        }
                    }
                    catch (Exception ex)
                    {
                        table.AddRow(new string[2]
                        {
                            activePlayer.UserIDString,
                            StringExtensions.QuoteSafe(ex.Message)
                        });
                    }
                }
            }
            else
            {
                string     str        = "N/A";
                BasePlayer basePlayer = BasePlayer.activePlayerList.Find((Predicate <BasePlayer>)(p => (long)p.userID == (long)filterID));
                if (Object.op_Implicit((Object)basePlayer))
                {
                    str = StringExtensions.QuoteSafe(basePlayer.GetSubName(32));
                }
                action(filterID, str);
            }
            arg.ReplyWith(((object)table).ToString());
        }
Esempio n. 22
0
        public static void stats(ConsoleSystem.Arg arg)
        {
            TextTable textTable = new TextTable();

            textTable.AddColumn("id");
            textTable.AddColumn("name");
            textTable.AddColumn("time");
            textTable.AddColumn("kills");
            textTable.AddColumn("deaths");
            textTable.AddColumn("suicides");
            textTable.AddColumn("player");
            textTable.AddColumn("building");
            textTable.AddColumn("entity");
            Action <ulong, string> action = (ulong id, string name) => {
                ServerStatistics.Storage storage = ServerStatistics.Get(id);
                string shortString = TimeSpan.FromSeconds((double)storage.Get("time")).ToShortString();
                string str         = storage.Get("kill_player").ToString();
                string str1        = (storage.Get("deaths") - storage.Get("death_suicide")).ToString();
                string str2        = storage.Get("death_suicide").ToString();
                string str3        = storage.Get("hit_player_direct_los").ToString();
                string str4        = storage.Get("hit_player_indirect_los").ToString();
                string str5        = storage.Get("hit_building_direct_los").ToString();
                string str6        = storage.Get("hit_building_indirect_los").ToString();
                string str7        = storage.Get("hit_entity_direct_los").ToString();
                string str8        = storage.Get("hit_entity_indirect_los").ToString();
                textTable.AddRow(new string[] { id.ToString(), name, shortString, str, str1, str2, string.Concat(str3, " / ", str4), string.Concat(str5, " / ", str6), string.Concat(str7, " / ", str8) });
            };
            ulong num = arg.GetUInt64(0, (ulong)0);

            if (num != 0)
            {
                string     str9       = "N/A";
                BasePlayer basePlayer = BasePlayer.activePlayerList.Find((BasePlayer p) => p.userID == num);
                if (basePlayer)
                {
                    str9 = basePlayer.GetSubName(32).QuoteSafe();
                }
                action(num, str9);
            }
            else
            {
                string str10 = arg.GetString(0, "");
                foreach (BasePlayer basePlayer1 in BasePlayer.activePlayerList)
                {
                    try
                    {
                        if (basePlayer1.IsValid())
                        {
                            string str11 = basePlayer1.GetSubName(32).QuoteSafe();
                            if (str10.Length <= 0 || str11.Contains(str10, CompareOptions.IgnoreCase))
                            {
                                action(basePlayer1.userID, str11);
                            }
                        }
                    }
                    catch (Exception exception1)
                    {
                        Exception exception = exception1;
                        textTable.AddRow(new string[] { basePlayer1.UserIDString, exception.Message.QuoteSafe() });
                    }
                }
            }
            arg.ReplyWith(textTable.ToString());
        }