public override void Use(Player p, string message) { if (message == "" || message.IndexOf(' ') == -1) { Help(p); return; } bool take = false; if (message.CaselessStarts("give ")) { message = message.Substring(5); } else if (message.CaselessStarts("take ")) { message = message.Substring(5); take = true; } string[] args = message.Split(trimChars, 2); string plName = args[0]; Player who = PlayerInfo.Find(plName); if (who != null) { plName = who.name; } string award = args.Length > 1 ? args[1] : ""; award = Awards.Find(award); if (award == null) { Player.SendMessage(p, "The award you entered doesn't exist"); Player.SendMessage(p, "Use /awards for a list of awards"); return; } if (!take) { if (Awards.GiveAward(plName, award)) { Player.GlobalMessage(Server.FindColor(plName) + plName + " %Swas awarded: &b" + award); } else { Player.SendMessage(p, "The player already has that award."); return; } } else { if (Awards.TakeAward(plName, award)) { Player.GlobalMessage(Server.FindColor(plName) + plName + " %Shad their &b" + award + " %Saward removed"); } else { Player.SendMessage(p, "The player didn't have the award you tried to take"); return; } } Awards.Save(); }
public static void Give(Player p, string award, ZombieGame game) { if (!ZombieGame.UseAwards) { return; } bool awarded = Awards.GiveAward(p.name, award); if (awarded && game.CurLevel != null) { game.CurLevel.ChatLevel(p.ColoredName + " %Searned the achievement &a" + award); } }
public override void Use(Player p, string message) { if (message == "" || message.IndexOf(' ') == -1) { Help(p); return; } string[] args = message.Split(trimChars, 3); string plName = args[args.Length - 2]; Player who = PlayerInfo.Find(plName); if (who != null) { plName = who.name; } string award = args[args.Length - 1]; if (!Awards.ExistsAward(award)) { Player.SendMessage(p, "The award you entered doesn't exist"); Player.SendMessage(p, "Use /awards for a list of awards"); return; } if (args.Length == 2 || !args[0].CaselessEq("take")) { if (Awards.GiveAward(plName, award)) { Player.GlobalMessage(Server.FindColor(plName) + plName + " %Swas awarded: &b" + award); } else { Player.SendMessage(p, "The player already has that award."); return; } } else { if (Awards.TakeAward(plName, award)) { Player.GlobalMessage(Server.FindColor(plName) + plName + " %Shad their &b" + award + " %Saward removed"); } else { Player.SendMessage(p, "The player didn't have the award you tried to take"); return; } } Awards.Save(); }
public override void Use(Player p, string message, CommandData data) { bool take = false; if (message.CaselessStarts("give ")) { message = message.Substring(5); } else if (message.CaselessStarts("take ")) { message = message.Substring(5); take = true; } string[] args = message.SplitSpaces(2); if (args.Length < 2) { Help(p); return; } string plName = PlayerInfo.FindMatchesPreferOnline(p, args[0]); if (plName == null) { return; } string award = Matcher.FindAwards(p, args[1]); if (award == null) { p.Message("Use &T/Awards %Sfor a list of awards"); return; } string displayName = p.FormatNick(plName); if (!take) { if (Awards.GiveAward(plName, award)) { Chat.MessageGlobal("{0} %Swas awarded: &b{1}", displayName, award); Awards.SavePlayers(); } else if (plName.CaselessEq(p.name)) { p.Message("You already have that award."); } else { p.Message("{0} %Salready has that award.", displayName); } } else { if (Awards.TakeAward(plName, award)) { Chat.MessageGlobal("{0} %Shad their &b{1} %Saward removed", displayName, award); Awards.SavePlayers(); } else if (plName.CaselessEq(p.name)) { p.Message("You did not have that award to begin with."); } else { p.Message("{0} %Sdid not have that award to begin with.", displayName); } } }
public override void Use(Player p, string message) { if (message == "" || message.IndexOf(' ') == -1) { Help(p); return; } bool take = false; if (message.CaselessStarts("give ")) { message = message.Substring(5); } else if (message.CaselessStarts("take ")) { message = message.Substring(5); take = true; } string[] args = message.SplitSpaces(2); string plName = PlayerInfo.FindMatchesPreferOnline(p, args[0]); if (plName == null) { return; } string award = args.Length > 1 ? args[1] : ""; int matches = 0; award = Awards.FindMatches(p, award, out matches); if (award == null) { Player.Message(p, "Use /awards for a list of awards"); return; } if (!take) { if (Awards.GiveAward(plName, award)) { Chat.MessageAll("{0} %Swas awarded: &b{1}", PlayerInfo.GetColoredName(p, plName), award); Awards.SavePlayers(); } else { Player.Message(p, "The player already has that award."); return; } } else { if (Awards.TakeAward(plName, award)) { Chat.MessageAll("{0} %Shad their &b{1} %Saward removed", PlayerInfo.GetColoredName(p, plName), award); Awards.SavePlayers(); } else { Player.Message(p, "The player didn't have the award you tried to take"); return; } } }