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, "&cerreur de colonne"); Help(p); return;
                }
                string awardName   = message.Split(':')[0].Trim();
                string description = message.Split(':')[1].Trim();

                if (!Awards.addAward(awardName, description))
                {
                    Player.SendMessage(p, "Ce trophe existe deja");
                }
                else
                {
                    Player.GlobalChat(p, "Trophe ajoute: &6" + awardName + " : " + description, false);
                }
            }
            else
            {
                if (!Awards.removeAward(message))
                {
                    Player.SendMessage(p, "Ce trophe n'existe pas");
                }
                else
                {
                    Player.GlobalChat(p, "Trophe supprime: &6" + message, false);
                }
            }

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

            bool give = true;

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

            string foundPlayer = message.Split(' ')[0];
            Player who         = Player.Find(message);

            if (who != null)
            {
                foundPlayer = who.name;
            }
            string awardName = message.Substring(message.IndexOf(' ') + 1);

            if (!Awards.awardExists(awardName))
            {
                Player.SendMessage(p, "Ce trophee n'existe pas");
                Player.SendMessage(p, "Utilise /awards pour avoir la liste des trophees");
                return;
            }

            if (give)
            {
                if (Awards.giveAward(foundPlayer, awardName))
                {
                    Player.GlobalChat(p, Server.FindColor(foundPlayer) + foundPlayer + Server.DefaultColor + " a eu le trophe: &b" + Awards.camelCase(awardName), false);
                }
                else
                {
                    Player.SendMessage(p, "Ce joueur a deja ce trophe");
                }
            }
            else
            {
                if (Awards.takeAward(foundPlayer, awardName))
                {
                    Player.GlobalChat(p, Server.FindColor(foundPlayer) + foundPlayer + Server.DefaultColor + " a perdu le trophe &b" + Awards.camelCase(awardName) + Server.DefaultColor, false);
                }
                else
                {
                    Player.SendMessage(p, "Ce joueur n'a pas le trophe que vous voulez lui enlever");
                }
            }

            Awards.Save();
        }