Beispiel #1
0
        public override void Use(Player p, string message)
        {
            if (message == "" || message.IndexOf(' ') == -1)
            {
                Help(p); return;
            }

            bool add = true;

            if (message.Split(' ')[0].ToLower() == "add")
            {
                message = message.Substring(message.IndexOf(' ') + 1);
            }
            else if (message.Split(' ')[0].ToLower() == "del")
            {
                add     = false;
                message = message.Substring(message.IndexOf(' ') + 1);
            }

            if (add)
            {
                if (message.IndexOf(":") == -1)
                {
                    Player.SendMessage(p, "&cMissing a colon!"); Help(p); return;
                }
                string awardName   = message.Split(':')[0].Trim();
                string description = message.Split(':')[1].Trim();

                if (!Awards.addAward(awardName, description))
                {
                    Player.SendMessage(p, "This award already exists!");
                }
                else
                {
                    Player.GlobalChat(p, "Award added: &6" + awardName + " : " + description, false);
                }
            }
            else
            {
                if (!Awards.removeAward(message))
                {
                    Player.SendMessage(p, "This award doesn't exists!");
                }
                else
                {
                    Player.GlobalChat(p, "Award removed: &6" + message, false);
                }
            }

            Awards.Save();
        }