예제 #1
0
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                Help(p); return;
            }
            string[] args = message.Split(' ');
            Player   who  = Player.Find(args[0]);

            if (who == null)
            {
                Player.SendMessage(p, "Could not find player.");
                return;
            }
            if (args.Length == 1)
            {
                who.titlecolor = "";
                Player.GlobalChat(who, who.color + who.name + Server.DefaultColor + " had their title color removed.", false);
                //PlayerDB.Save(who);
                Server.s.database.GetTable("Players").SetValue(Server.s.database.GetTable("Players").Rows.IndexOf(Server.s.database.GetTable("Players").GetRow(new string[] { "Name" }, new string[] { who.name })), "TColor", "");
                who.SetPrefix();
                return;
            }
            else
            {
                string color = c.Parse(args[1]);
                if (color == "")
                {
                    Player.SendMessage(p, "There is no color \"" + args[1] + "\"."); return;
                }
                else if (color == who.titlecolor)
                {
                    Player.SendMessage(p, who.name + " already has that title color."); return;
                }
                else
                {
                    Player.GlobalChat(who, who.color + who.name + Server.DefaultColor + " had their title color changed to " + color + c.Name(color) + Server.DefaultColor + ".", false);
                    who.titlecolor = color;
                    //PlayerDB.Save(who);
                    Server.s.database.GetTable("Players").SetValue(Server.s.database.GetTable("Players").Rows.IndexOf(Server.s.database.GetTable("Players").GetRow(new string[] { "Name" }, new string[] { who.name })), "TColor", color);
                    who.SetPrefix();
                }
            }
        }
예제 #2
0
        public override void Use(Player p, string message)
        {
            if (message == "" || message.Split(' ').Length > 2)
            {
                Help(p); return;
            }
            int pos = message.IndexOf(' ');

            if (pos != -1)
            {
                Player who = Player.Find(message.Substring(0, pos));
                if (who == null)
                {
                    Player.SendMessage(p, "There is no player \"" + message.Substring(0, pos) + "\"!"); return;
                }
                if (message.Substring(pos + 1) == "del")
                {
                    Player.GlobalChat(who, who.color + "*" + Name(who.name) + " color reverted to " + who.group.color + "their group's default" + Server.DefaultColor + ".", false);
                    //PlayerDB.Save(who);
                    Server.s.database.GetTable("Players").SetValue(Server.s.database.GetTable("Players").Rows.IndexOf(Server.s.database.GetTable("Players").GetRow(new string[] { "Name" }, new string[] { who.name })), "Color", "");
                    who.color = who.group.color;
                    Player.GlobalDie(who, false);
                    Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false);
                    who.SetPrefix();
                    return;
                }
                string color = c.Parse(message.Substring(pos + 1));
                if (color == "")
                {
                    Player.SendMessage(p, "There is no color \"" + message + "\".");
                }
                else if (color == who.color)
                {
                    Player.SendMessage(p, who.name + " already has that color.");
                }
                else
                {
                    //Player.GlobalChat(who, p.color + "*" + p.name + "&e changed " + who.color + Name(who.name) +
                    //                  " color to " + color +
                    //                  c.Name(color) + "&e.", false);
                    Player.GlobalChat(who, who.color + "*" + Name(who.name) + " color changed to " + color + c.Name(color) + Server.DefaultColor + ".", false);
                    who.color = color;
                    //PlayerDB.Save(who);

                    Server.s.database.GetTable("Players").SetValue(Server.s.database.GetTable("Players").Rows.IndexOf(Server.s.database.GetTable("Players").GetRow(new string[] { "Name" }, new string[] { who.name })), "Color", color);
                    Player.GlobalDie(who, false);
                    Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false);
                    who.SetPrefix();
                }
            }
            else
            {
                if (p == null)
                {
                    Help(p); return;
                }
                if (message == "del")
                {
                    Player.GlobalChat(p, p.color + "*" + Name(p.name) + " color reverted to " + p.group.color + "their group's default" + Server.DefaultColor + ".", false);
                    //p.color = "group";
                    //PlayerDB.Save(p);

                    Server.s.database.GetTable("Players").SetValue(Server.s.database.GetTable("Players").Rows.IndexOf(Server.s.database.GetTable("Players").GetRow(new string[] { "Name" }, new string[] { p.name })), "Color", "");
                    p.color = p.group.color;
                    Player.GlobalDie(p, false);
                    Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false);
                    p.SetPrefix();
                    return;
                }
                string color = c.Parse(message);
                if (color == "")
                {
                    Player.SendMessage(p, "There is no color \"" + message + "\".");
                }
                else if (color == p.color)
                {
                    Player.SendMessage(p, "You already have that color.");
                }
                else
                {
                    Player.GlobalChat(p, p.color + "*" + Name(p.name) + " color changed to " + color + c.Name(color) + Server.DefaultColor + ".", false);
                    p.color = color;
                    //PlayerDB.Save(p);

                    Server.s.database.GetTable("Players").SetValue(Server.s.database.GetTable("Players").Rows.IndexOf(Server.s.database.GetTable("Players").GetRow(new string[] { "Name" }, new string[] { p.name })), "Color", color);
                    Player.GlobalDie(p, false);
                    Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false);
                    p.SetPrefix();
                }
            }
        }
예제 #3
0
파일: CmdTitle.cs 프로젝트: xeons/MCSong
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                Help(p); return;
            }

            int    pos = message.IndexOf(' ');
            Player who = Player.Find(message.Split(' ')[0]);

            if (who == null)
            {
                Player.SendMessage(p, "Could not find player."); return;
            }

            string newTitle = "";

            if (message.Split(' ').Length > 1)
            {
                newTitle = message.Substring(pos + 1);
            }
            else
            {
                who.title = "";
                who.SetPrefix();
                Player.GlobalChat(null, who.color + who.name + Server.DefaultColor + " had their title removed.", false);

                /*query = "UPDATE Players SET Title = '' WHERE Name = '" + who.name + "'";
                 * MySQL.executeQuery(query);*/
                //PlayerDB.Save(who);
                Server.s.database.GetTable("Players").SetValue(Server.s.database.GetTable("Players").Rows.IndexOf(Server.s.database.GetTable("Players").GetRow(new string[] { "Name" }, new string[] { who.name })), "Title", "");
                return;
            }

            if (newTitle != "")
            {
                newTitle = newTitle.ToString().Trim().Replace("[", "");
                newTitle = newTitle.Replace("]", "");

                /* if (newTitle[0].ToString() != "[") newTitle = "[" + newTitle;
                 * if (newTitle.Trim()[newTitle.Trim().Length - 1].ToString() != "]") newTitle = newTitle.Trim() + "]";
                 * if (newTitle[newTitle.Length - 1].ToString() != " ") newTitle = newTitle + " "; */
            }

            if (newTitle.Length > 17)
            {
                Player.SendMessage(p, "Title must be under 17 letters."); return;
            }
            if (!Server.devs.Contains(p.name))
            {
                if (Server.devs.Contains(who.name) || newTitle.ToLower() == "dev")
                {
                    Player.SendMessage(p, "Can't let you do that, starfox."); return;
                }
            }

            if (newTitle != "")
            {
                Player.GlobalChat(null, who.color + who.name + Server.DefaultColor + " was given the title of &b[" + newTitle + "]", false);
            }
            else
            {
                Player.GlobalChat(null, who.color + who.prefix + who.name + Server.DefaultColor + " had their title removed.", false);
            }

            /*if (newTitle == "")
             * {
             *  query = "UPDATE Players SET Title = '' WHERE Name = '" + who.name + "'";
             * }
             * else
             * {
             *  query = "UPDATE Players SET Title = '" + newTitle.Replace("'", "\'") + "' WHERE Name = '" + who.name + "'";
             * }
             * MySQL.executeQuery(query);*/
            who.title = newTitle;
            //PlayerDB.Save(who);
            Server.s.database.GetTable("Players").SetValue(Server.s.database.GetTable("Players").Rows.IndexOf(Server.s.database.GetTable("Players").GetRow(new string[] { "Name" }, new string[] { who.name })), "Title", newTitle);
            who.SetPrefix();
        }
예제 #4
0
        public override void Use(Player p, string message)
        {
            if (!Server.useMySQL) { p.SendMessage("MySQL has not been configured! Please configure MySQL to use Colors!"); return; }
            if (message == "" || message.Split(' ').Length > 2) { Help(p); return; }
            int pos = message.IndexOf(' ');
            if (pos != -1)
            {
                Player who = Player.Find(message.Substring(0, pos));
                if (who == null) { Player.SendMessage(p, "There is no player \"" + message.Substring(0, pos) + "\"!"); return; }
                if (message.Substring(pos + 1) == "del")
                {
                    MySQL.executeQuery("UPDATE Players SET color = '' WHERE name = '" + who.name + "'");
                    Player.GlobalChat(who, who.color + "*" + Name(who.name) + " color reverted to " + who.group.color + "their group's default" + Server.DefaultColor + ".", false);
                    who.color = who.group.color;

                    Player.GlobalDie(who, false);
                    Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false);
                    who.SetPrefix();
                    return;
                }
                string color = c.Parse(message.Substring(pos + 1));
                if (color == "") { Player.SendMessage(p, "There is no color \"" + message + "\"."); }
                else if (color == who.color) { Player.SendMessage(p, who.name + " already has that color."); }
                else
                {
                    //Player.GlobalChat(who, p.color + "*" + p.name + "&e changed " + who.color + Name(who.name) +
                    //                  " color to " + color +
                    //                  c.Name(color) + "&e.", false);
                    MySQL.executeQuery("UPDATE Players SET color = '" + c.Name(color) + "' WHERE name = '" + who.name + "'");

                    Player.GlobalChat(who, who.color + "*" + Name(who.name) + " color changed to " + color + c.Name(color) + Server.DefaultColor + ".", false);
                    who.color = color;

                    Player.GlobalDie(who, false);
                    Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false);
                    who.SetPrefix();
                }
            }
            else
            {
                if (message == "del")
                {
                    MySQL.executeQuery("UPDATE Players SET color = '' WHERE name = '" + p.name + "'");

                    Player.GlobalChat(p, p.color + "*" + Name(p.name) + " color reverted to " + p.group.color + "their group's default" + Server.DefaultColor + ".", false);
                    p.color = p.group.color;

                    Player.GlobalDie(p, false);
                    Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false);
                    p.SetPrefix();
                    return;
                }
                string color = c.Parse(message);
                if (color == "") { Player.SendMessage(p, "There is no color \"" + message + "\"."); }
                else if (color == p.color) { Player.SendMessage(p, "You already have that color."); }
                else
                {
                    MySQL.executeQuery("UPDATE Players SET color = '" + c.Name(color) + "' WHERE name = '" + p.name + "'");

                    Player.GlobalChat(p, p.color + "*" + Name(p.name) + " color changed to " + color + c.Name(color) + Server.DefaultColor + ".", false);
                    p.color = color;

                    Player.GlobalDie(p, false);
                    Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false);
                    p.SetPrefix();
                }
            }
        }