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); } }
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)); }
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); } }
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"); } }
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"); } }