Esempio n. 1
0
        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();
        }