public override void Use(Player p, string message) { if (message == "") { Help(p); return; } Player who; string killMsg; int killMethod = 0; if (message.IndexOf(' ') == -1) { who = Player.Find(message); killMsg = " was killed by " + p.color + p.name; } else { who = Player.Find(message.Split(' ')[0]); message = message.Substring(message.IndexOf(' ') + 1); if (message.IndexOf(' ') == -1) { if (message.ToLower() == "explode") { killMsg = " was exploded by " + p.color + p.name; killMethod = 1; } else { killMsg = " " + message; } } else { if (message.Split(' ')[0].ToLower() == "explode") { killMethod = 1; message = message.Substring(message.IndexOf(' ') + 1); } killMsg = " " + message; } } if (who == null) { p.HandleDeath(Block.rock, " killed itself in its confusion"); Player.SendMessage(p, "Could not find player"); return; } if (who.group.Permission > p.group.Permission) { p.HandleDeath(Block.rock, " was killed by " + who.color + who.name); Player.SendMessage(p, "Cannot kill someone of higher rank"); return; } if (killMethod == 1) { who.HandleDeath(Block.rock, killMsg, true); } else { who.HandleDeath(Block.rock, killMsg); } }
public override void Use(Player p, string message) { if (message == "") { Help(p); return; } Player who; string killMsg; int killMethod = 0; if (message.IndexOf(' ') == -1) { who = Player.Find(message); if (p != null) { killMsg = " was killed by " + p.color + p.name; } else { killMsg = " was killed by " + "the Console."; } } else { who = Player.Find(message.Split(' ')[0]); message = message.Substring(message.IndexOf(' ') + 1); if (message.IndexOf(' ') == -1) { if (message.ToLower() == "explode") { if (p != null) { killMsg = " was exploded by " + p.color + p.name; } else { killMsg = " was exploded by the Console."; } killMethod = 1; } else { killMsg = " " + message; } } else { if (message.Split(' ')[0].ToLower() == "explode") { killMethod = 1; message = message.Substring(message.IndexOf(' ') + 1); } killMsg = " " + message; } } if (who == null) { if (p != null) { p.HandleDeath(Block.rock, " killed itself in its confusion"); } Player.SendMessage(p, "Could not find player"); return; } if (p != null) { if (who.group.Permission > p.group.Permission) { p.HandleDeath(Block.rock, " was killed by " + who.color + who.name); Player.SendMessage(p, "Cannot kill someone of higher rank"); return; } } if (killMethod == 1) who.HandleDeath(Block.rock, killMsg, true); else who.HandleDeath(Block.rock, killMsg); }