public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response) { if (!(sender as CommandSender).CheckPermission("ct.explode")) { response = "You do not have permission to run this command! Missing permission: \"ct.explode\""; return(false); } if (arguments.Count != 0) { response = "Usage: explode all / *"; return(false); } foreach (Exiled.API.Features.Player Ply in Exiled.API.Features.Player.List) { if (Ply.Role == RoleType.Spectator || Ply.Role == RoleType.None) { continue; } Ply.Kill(); CreativeToolboxEventHandler.SpawnGrenadeOnPlayer(Ply, false); } response = "Everyone exploded, Hubert cannot believe you have done this"; return(true); }
protected override bool ExecuteParent(ArraySegment <string> arguments, ICommandSender sender, out string response) { EventHandlers.LogCommandUsed((CommandSender)sender, EventHandlers.FormatArguments(arguments, 0)); if (!((CommandSender)sender).CheckPermission("at.kill")) { response = "You do not have permission to use this command"; return(false); } if (arguments.Count != 1) { response = "Usage: kill ((player id / name) or (all / *))"; return(false); } switch (arguments.At(0)) { case "*": case "all": foreach (Player Ply in Player.List) { if (Ply.Role == RoleType.Spectator || Ply.Role == RoleType.None) { continue; } Ply.Kill(); } response = "Everyone has been game ended (killed) now"; return(true); default: Player Pl = Player.Get(arguments.At(0)); if (Pl == null) { response = $"Player not found: {arguments.At(0)}"; return(false); } else if (Pl.Role == RoleType.Spectator || Pl.Role == RoleType.None) { response = $"Player {Pl.Nickname} is not a valid class to kill"; return(false); } Pl.Kill(); response = $"Player {Pl.Nickname} has been game ended (killed) now"; return(true); } }
protected override bool ExecuteParent(ArraySegment <string> arguments, ICommandSender sender, out string response) { EventHandlers.LogCommandUsed((CommandSender)sender, EventHandlers.FormatArguments(arguments, 0)); if (!((CommandSender)sender).CheckPermission("at.explode")) { response = "You do not have permission to use this command"; return(false); } if (arguments.Count != 1) { response = "Usage: expl ((player id / name) or (all / *))"; return(false); } switch (arguments.At(0)) { case "*": case "all": if (arguments.Count != 1) { response = "Usage: expl (all / *)"; return(false); } foreach (Player Ply in Player.List) { if (Ply.Role == RoleType.Spectator || Ply.Role == RoleType.None) { continue; } Ply.Kill(); EventHandlers.SpawnGrenadeOnPlayer(Ply, GrenadeType.Frag, 0.1f); } response = "Everyone exploded, Hubert cannot believe you have done this"; return(true); default: if (arguments.Count != 1) { response = "Usage: expl (player id / name)"; return(false); } Player Pl = Player.Get(arguments.At(0)); if (Pl == null) { response = $"Invalid target to explode: {arguments.At(0)}"; return(false); } if (Pl.Role == RoleType.Spectator || Pl.Role == RoleType.None) { response = $"Player \"{Pl.Nickname}\" is not a valid class to explode"; return(false); } Pl.Kill(); EventHandlers.SpawnGrenadeOnPlayer(Pl, GrenadeType.Frag, 0.1f); response = $"Player \"{Pl.Nickname}\" game ended (exploded)"; return(true); } }