当前位置: 首页>>代码示例>>C#>>正文


C# ConsoleSystem.GetInt方法代码示例

本文整理汇总了C#中ConsoleSystem.GetInt方法的典型用法代码示例。如果您正苦于以下问题:C# ConsoleSystem.GetInt方法的具体用法?C# ConsoleSystem.GetInt怎么用?C# ConsoleSystem.GetInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConsoleSystem的用法示例。


在下文中一共展示了ConsoleSystem.GetInt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CmdGroup

        private void CmdGroup(ConsoleSystem.Arg arg)
        {
            if (!PermissionsLoaded(arg)) return;
            if (!IsAdmin(arg)) return;
            if (!arg.HasArgs(2))
            {
                ReplyWith(arg.connection, "CommandUsageGroup");
                return;
            }

            var mode = arg.GetString(0);
            var name = arg.GetString(1);

            if (mode.Equals("add"))
            {
                if (permission.GroupExists(name))
                {
                    ReplyWith(arg.connection, "GroupAlreadyExists", name);
                    return;
                }
                permission.CreateGroup(name, arg.GetString(2), arg.GetInt(3));
                ReplyWith(arg.connection, "GroupCreated", name);
            }
            else if (mode.Equals("remove"))
            {
                if (!permission.GroupExists(name))
                {
                    ReplyWith(arg.connection, "GroupNotFound", name);
                    return;
                }
                permission.RemoveGroup(name);
                ReplyWith(arg.connection, "GroupDeleted", name);
            }
            else if (mode.Equals("set"))
            {
                if (!permission.GroupExists(name))
                {
                    ReplyWith(arg.connection, "GroupNotFound", name);
                    return;
                }
                permission.SetGroupTitle(name, arg.GetString(2));
                permission.SetGroupRank(name, arg.GetInt(3));
                ReplyWith(arg.connection, "GroupChanged", name);
            }
            else if (mode.Equals("parent"))
            {
                if (!permission.GroupExists(name))
                {
                    ReplyWith(arg.connection, "GroupNotFound", name);
                    return;
                }
                var parent = arg.GetString(2);
                if (!string.IsNullOrEmpty(parent) && !permission.GroupExists(parent))
                {
                    ReplyWith(arg.connection, "GroupParentNotFound", parent);
                    return;
                }
                if (permission.SetGroupParent(name, parent))
                    ReplyWith(arg.connection, "GroupParentChanged", name, parent);
                else
                    ReplyWith(arg.connection, "GroupParentNotChanged", name);
            }
        }
开发者ID:906507516,项目名称:Oxide,代码行数:63,代码来源:RustCore.cs

示例2: cmdConsoleKitShow

        void cmdConsoleKitShow(ConsoleSystem.Arg arg)
        {
            if (arg.connection == null)
            {
                SendReply(arg, "You can't use this command from the server console");
                return;
            }
            if (!arg.HasArgs())
            {
                SendReply(arg, "You are not allowed to use manually this command");
                return;
            }

            var player = arg.Player();

            PLayerGUI playerGUI;
            if (!PlayerGUI.TryGetValue(player.userID, out playerGUI)) return;

            RefreshKitPanel(player, playerGUI.guiid, arg.GetInt(0));
        }
开发者ID:Arkoudaphobia,项目名称:ArkoudaphobiaConfig,代码行数:20,代码来源:Kits.cs

示例3: cmdGroup

        private void cmdGroup(ConsoleSystem.Arg arg)
        {
            if (!PermissionsLoaded(arg)) return;

            if (arg.Player() != null && !arg.Player().IsAdmin()) return;
            // Check 2 args exists
            if (!arg.HasArgs(2))
            {
                var reply = "Syntax: oxide.group <add|set> <name> [title] [rank]\n";
                reply += "Syntax: oxide.group <remove|show> <name>\n";
                reply += "Syntax: oxide.group <parent> <name> <parentName>";
                arg.ReplyWith(reply);
                return;
            }

            var mode = arg.GetString(0);
            var name = arg.GetString(1);

            if (mode.Equals("add"))
            {
                if (permission.GroupExists(name))
                {
                    arg.ReplyWith("Group '" + name + "' already exist");
                    return;
                }
                permission.CreateGroup(name, arg.GetString(2), arg.GetInt(3));
                arg.ReplyWith("Group '" + name + "' created");
            }
            else if (mode.Equals("remove"))
            {
                if (!permission.GroupExists(name))
                {
                    arg.ReplyWith("Group '" + name + "' doesn't exist");
                    return;
                }
                permission.RemoveGroup(name);
                arg.ReplyWith("Group '" + name + "' deleted");
            }
            else if (mode.Equals("set"))
            {
                if (!permission.GroupExists(name))
                {
                    arg.ReplyWith("Group '" + name + "' doesn't exist");
                    return;
                }
                permission.SetGroupTitle(name, arg.GetString(2));
                permission.SetGroupRank(name, arg.GetInt(3));
                arg.ReplyWith("Group '" + name + "' changed");
            }
            else if (mode.Equals("parent"))
            {
                if (!permission.GroupExists(name))
                {
                    arg.ReplyWith("Group '" + name + "' doesn't exist");
                    return;
                }
                var parent = arg.GetString(2);
                if (!string.IsNullOrEmpty(parent) && !permission.GroupExists(parent))
                {
                    arg.ReplyWith("Parent group '" + parent + "' doesn't exist");
                    return;
                }
                if (permission.SetGroupParent(name, parent))
                    arg.ReplyWith("Group '" + name + "' changed");
                else
                    arg.ReplyWith("Group '" + name + "' failed to change");
            }
            else if (mode.Equals("show"))
            {
                if (!permission.GroupExists(name))
                {
                    arg.ReplyWith("Group '" + name + "' doesn't exist");
                    return;
                }
                var result = "Group '" + name + "' permissions:\n";
                result += string.Join(",", permission.GetGroupPermissions(name));
                arg.ReplyWith(result);
            }
        }
开发者ID:HalfShotz,项目名称:Oxide,代码行数:79,代码来源:RustCore.cs

示例4: cmdGroup

        private void cmdGroup(ConsoleSystem.Arg arg)
        {
            if (!PermissionsLoaded(arg)) return;
            if (!IsAdmin(arg)) return;
            if (!arg.HasArgs(2))
            {
                var reply = "Syntax: group <add|set> <name> [title] [rank]";
                reply += "Syntax: group <remove> <name>\n";
                reply += "Syntax: group <parent> <name> <parentName>";
                arg.ReplyWith(reply);
                return;
            }

            var mode = arg.GetString(0);
            var name = arg.GetString(1);
            var title = arg.GetString(2);
            var rank = arg.GetInt(3);

            if (mode.Equals("add"))
            {
                if (permission.GroupExists(name))
                {
                    arg.ReplyWith("Group '" + name + "' already exist");
                    return;
                }
                permission.CreateGroup(name, title, rank);
                arg.ReplyWith("Group '" + name + "' created");
            }
            else if (mode.Equals("remove"))
            {
                if (!permission.GroupExists(name))
                {
                    arg.ReplyWith("Group '" + name + "' doesn't exist");
                    return;
                }
                permission.RemoveGroup(name);
                arg.ReplyWith("Group '" + name + "' deleted");
            }
            else if (mode.Equals("set"))
            {
                if (!permission.GroupExists(name))
                {
                    arg.ReplyWith("Group '" + name + "' doesn't exist");
                    return;
                }
                permission.SetGroupTitle(name, title);
                permission.SetGroupRank(name, rank);
                arg.ReplyWith("Group '" + name + "' changed");
            }
        }
开发者ID:906507516,项目名称:Oxide,代码行数:50,代码来源:RustLegacyCore.cs

示例5: cmdGroup

        private void cmdGroup(ConsoleSystem.Arg arg)
        {
            if (!PermissionsLoaded(arg)) return;

            if (arg.argUser != null && !arg.argUser.CanAdmin()) return;
            // Check 2 args exists
            if (!arg.HasArgs(2))
            {
                arg.ReplyWith("Syntax: oxide.group <add|remove|set> <name> [title] [rank]");
                return;
            }

            var mode = arg.GetString(0);
            var name = arg.GetString(1);
            var title = arg.GetString(2);
            var rank = arg.GetInt(3);

            if (mode.Equals("add"))
            {
                if (permission.GroupExists(name))
                {
                    arg.ReplyWith("Group '" + name + "' already exist");
                    return;
                }
                permission.CreateGroup(name, title, rank);
                arg.ReplyWith("Group '" + name + "' created");
            }
            else if (mode.Equals("remove"))
            {
                if (!permission.GroupExists(name))
                {
                    arg.ReplyWith("Group '" + name + "' doesn't exist");
                    return;
                }
                permission.RemoveGroup(name);
                arg.ReplyWith("Group '" + name + "' deleted");
            }
            else if (mode.Equals("set"))
            {
                if (!permission.GroupExists(name))
                {
                    arg.ReplyWith("Group '" + name + "' doesn't exist");
                    return;
                }
                permission.SetGroupTitle(name, title);
                permission.SetGroupRank(name, rank);
                arg.ReplyWith("Group '" + name + "' changed");
            }
        }
开发者ID:CypressCube,项目名称:Oxide,代码行数:49,代码来源:RustLegacyCore.cs


注:本文中的ConsoleSystem.GetInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。