Пример #1
0
        public override void Use(Player p, string message)
        {
            if (p == null)
            {
                p.SendMessage("Command not usable in Console."); return;
            }
            if (message == "" || message.Split(' ').Length > 2)
            {
                Help(p); return;
            }
            switch (message.Split(' ')[0].ToLower())
            {
            case "global":
                if (message.Split(' ').Length > 1)
                {
                    goto default;
                }
                if (!Server.ignoreGlobal.Contains(p.name.ToLower()))
                {
                    Server.ignoreGlobal.Add(p.name.ToLower());
                    p.SendMessage("You are now ignoring incoming chat messages from Global Chat.");
                }
                else
                {
                    Server.ignoreGlobal.Remove(p.name.ToLower());
                    p.SendMessage("You are no longer ignoring incoming chat messages from Global Chat.");
                }
                Server.ignoreGlobal.GCIgnoreSave();
                Server.ignoreGlobal = PlayerList.GCIgnoreLoad();
                break;

            default:
                Player who     = Player.Find(message.Split(' ')[0]);
                string ignored = "";
                if (who != null)
                {
                    ignored = who.name;
                }
                else
                {
                    ignored = message.Split(' ')[0];
                }

                if (Server.allowIgnoreOps && (Server.hasProtection(name)) || who.group.Permission >= LevelPermission.Operator || Group.findPlayerGroup(ignored).Permission >= LevelPermission.Operator)
                {
                    Player.SendMessage(p, "Cannot ignore operators."); return;
                }

                if (p.ignoreList.Contains(ignored.ToLower()))
                {
                    Player.IgnoreRemove(p, ignored.ToLower());
                    p.SendMessage("You are no longer ignoring incoming chat messages from " + ignored + ".");
                }
                else
                {
                    foreach (Group gr in Group.GroupList)
                    {
                        if (gr.playerList.Contains(ignored.ToLower()) && gr.Permission >= LevelPermission.Operator && !Server.allowIgnoreOps || Server.devs.Contains(ignored.ToLower()) || Server.staff.Contains(ignored.ToLower()) || Server.administration.Contains(ignored.ToLower()))
                        {
                            p.SendMessage("You can't ignore a " + who.group.trueName + "."); return;
                        }
                    }
                    Player.IgnoreAdd(p, ignored.ToLower());
                    p.SendMessage("You are now ignoring incoming chat messages from " + ignored + ".");
                }
                break;
            }
        }
Пример #2
0
        public override void Use(Player p, string message)
        {
            if (message.Split(' ').Length < 2)
            {
                Help(p); return;
            }
            Player who     = Player.Find(message.Split(' ')[0]);
            Group  newRank = Group.Find(message.Split(' ')[1]);
            string msgGave;

            if (p != null)
            {
                if (message.Split(' ').Length > 2)
                {
                    msgGave = message.Substring(message.IndexOf(' ', message.IndexOf(' ') + 1)) + " (" + p.name + ")";
                }
                else
                {
                    msgGave = "No reason given. (" + p.name + ").";
                }
            }
            else
            if (message.Split(' ').Length > 2)
            {
                msgGave = message.Substring(message.IndexOf(' ', message.IndexOf(' ') + 1)) + " (Console)";
            }
            else
            {
                msgGave = "No reason given. (Console).";
            }
            if (newRank == null)
            {
                Player.SendMessage(p, "Could not find specified rank."); return;
            }

            Group bannedGroup = Group.findPerm(LevelPermission.Banned);

            if (who == null)
            {
                //if (Server.devs.Contains(message.ToLower())) { p.SendMessage("Can't let you do that, Starfox."); return; }
                string foundName = message.Split(' ')[0];
                if (Group.findPlayerGroup(foundName) == bannedGroup || newRank == bannedGroup)
                {
                    Player.SendMessage(p, "Cannot change the rank to or from \"" + bannedGroup.name + "\".");
                    return;
                }

                if (p != null)
                {
                    if (Group.findPlayerGroup(foundName).Permission >= p.group.Permission || newRank.Permission >= p.group.Permission)
                    {
                        Player.SendMessage(p, "Cannot change the rank of someone equal or higher than you"); return;
                    }
                }

                Group oldGroup = Group.findPlayerGroup(foundName);
                oldGroup.playerList.Remove(foundName);
                oldGroup.playerList.Save();

                newRank.playerList.Add(foundName);
                newRank.playerList.Save();

                msgGave = msgGave.Trim();
                Player.GlobalMessage(foundName + " &f(offline)" + "&g's rank was set to " + newRank.color + newRank.name);
                MySQL.executeQuery("UPDATE Players SET lastRankReason = '[" + DateTime.Now.ToString() + "] " + msgGave.Replace("'", "\\'") + "' WHERE Name = '" + foundName + "'");
                Player.GlobalChat(null, "&6Reason: &f" + msgGave, false);
            }
            else
            {
                //if (!Server.devs.Contains(p.name) && Server.devs.Contains(who.name)) { p.SendMessage("Can't let you do that, Starfox."); return; }
                if (p != null)
                {
                    if (who.group == bannedGroup || newRank == bannedGroup)
                    {
                        Player.SendMessage(p, "Cannot change the rank to or from \"" + bannedGroup.name + "\".");
                        return;
                    }

                    if (who.group.Permission >= p.group.Permission || newRank.Permission >= p.group.Permission)
                    {
                        Player.SendMessage(p, "Cannot change the rank of someone equal or higher to yourself."); return;
                    }
                }

                who.group.playerList.Remove(who.name);
                who.group.playerList.Save();

                newRank.playerList.Add(who.name);
                newRank.playerList.Save();

                msgGave = msgGave.Trim();
                Player.GlobalChat(who, who.color + who.name + "&g's rank was set to " + newRank.color + newRank.name, false);
                Player.GlobalChat(null, "&6Reason: &f" + msgGave, false);
                who.group = newRank;
                who.color = who.group.color;
                Player.GlobalDie(who, false);
                who.SendMessage("You are now ranked " + newRank.color + newRank.name + "&g, type /help for your new set of commands.");
                Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false);
                try { if (!Server.cli)
                      {
                          MCDawn.Gui.Window.thisWindow.UpdateClientList(Player.players);
                      }
                }
                catch { }
                MySQL.executeQuery("UPDATE Players SET lastRankReason = '[" + DateTime.Now.ToString() + "] " + msgGave.Replace("'", "\\'") + "' WHERE Name = '" + who.originalName + "'");
                who.lastRankReason = "[" + DateTime.Now.ToString() + "] " + msgGave;
            }
        }
Пример #3
0
        public override void Use(Player p, string message)
        {
            string usingName = "";

            if (message == "")
            {
                Help(p); return;
            }
            if (message[0] == '@')
            {
                usingName = message.Remove(0, 1).Trim();
                message   = message.Remove(0, 1).Trim();
                message   = message.Replace("'", "\\'");
                message   = message.Replace("--", "");
                Player who = Player.Find(message);
                if (Server.devs.Contains(message.ToLower()))
                {
                    Player.SendMessage(p, "Woah!! You can't ban a MCDawn Developer!");
                    if (p != null)
                    {
                        Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " is crazy! Trying to ban a MCDawn Developer!");
                    }
                    else
                    {
                        Player.GlobalMessage("The Console is crazy! Trying to ban a MCDawn Developer!");
                    }
                    return;
                }
                if (Server.staff.Contains(message.ToLower()))
                {
                    Player.SendMessage(p, "Woah!! You can't ban a MCDawn Staff Member!");
                    if (p != null)
                    {
                        Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " is crazy! Trying to ban a MCDawn Staff Member!");
                    }
                    else
                    {
                        Player.GlobalMessage("The Console is crazy! Trying to ban a MCDawn Staff Member!");
                    }
                    return;
                }
                if (Server.administration.Contains(message.ToLower()))
                {
                    Player.SendMessage(p, "Woah!! You can't ban a MCDawn Administrator!");
                    if (p != null)
                    {
                        Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " is crazy! Trying to ban a MCDawn Administrator!");
                    }
                    else
                    {
                        Player.GlobalMessage("The Console is crazy! Trying to ban a MCDawn Administrator!");
                    }
                    return;
                }
                if (who == null)
                {
                    DataTable ip;
                    int       tryCounter = 0;
                    rerun :  try
                    {
                        ip = MySQL.fillData("SELECT IP FROM Players WHERE Name = '" + message + "'");
                    }
                    catch (Exception e)
                    {
                        tryCounter++;
                        if (tryCounter < 10)
                        {
                            goto rerun;
                        }
                        else
                        {
                            Server.ErrorLog(e);
                            return;
                        }
                    }
                    if (ip.Rows.Count > 0)
                    {
                        message = ip.Rows[0]["IP"].ToString();
                    }
                    else
                    {
                        Player.SendMessage(p, "Unable to find an IP address for that user.");
                        return;
                    }
                    ip.Dispose();
                }
                else
                {
                    message = who.ip;
                }
            }
            else
            {
                Player who = Player.Find(message);
                if (who != null)
                {
                    message = who.ip;
                }
            }

            if (message.Contains("127.0.0.") || message.Contains("192.168."))
            {
                Player.SendMessage(p, "You can't ip-ban the server!"); return;
            }
            if (message.IndexOf('.') == -1)
            {
                Player.SendMessage(p, "Invalid IP!"); return;
            }
            if (message.Split('.').Length != 4)
            {
                Player.SendMessage(p, "Invalid IP!"); return;
            }
            if (p != null && p.ip == message)
            {
                Player.SendMessage(p, "You can't ip-ban yourself.!"); return;
            }
            if (Server.bannedIP.Contains(message))
            {
                Player.SendMessage(p, message + " is already ip-banned."); return;
            }

            // Check if IP belongs to an op+
            // First get names of active ops+ with that ip
            List <string> opNamesWithThatIP = (from pl in Player.players where (pl.ip == message && [email protected] >= LevelPermission.Operator) select pl.originalName).ToList();
            List <string> devCheck          = (from pl in Player.players where (pl.ip == message && (Server.devs.Contains(pl.originalName.ToLower()) || Server.staff.Contains(pl.originalName.ToLower()) || Server.administration.Contains(pl.originalName.ToLower()))) select pl.originalName).ToList();
            // Next, add names from the database
            DataTable dbnames = MySQL.fillData("SELECT Name FROM Players WHERE IP = '" + message + "'");

            foreach (DataRow row in dbnames.Rows)
            {
                opNamesWithThatIP.Add(row[0].ToString());
            }

            foreach (DataRow row in dbnames.Rows)
            {
                devCheck.Add(row[0].ToString());
            }

            if (devCheck != null && devCheck.Count > 0)
            {
                foreach (string dev in devCheck)
                {
                    if (Server.devs.Contains(dev.ToLower()))
                    {
                        Player.SendMessage(p, "Woah!! You can't ban a MCDawn Developer!");
                        if (p != null)
                        {
                            Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " is crazy! Trying to ban a MCDawn Developer!");
                        }
                        else
                        {
                            Player.GlobalMessage("The Console is crazy! Trying to ban a MCDawn Developer!");
                        }
                        return;
                    }
                    if (Server.staff.Contains(dev.ToLower()))
                    {
                        Player.SendMessage(p, "Woah!! You can't ban a MCDawn Staff Member!");
                        if (p != null)
                        {
                            Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " is crazy! Trying to ban a MCDawn Staff Member!");
                        }
                        else
                        {
                            Player.GlobalMessage("The Console is crazy! Trying to ban a MCDawn Staff Member!");
                        }
                        return;
                    }
                    if (Server.administration.Contains(dev.ToLower()))
                    {
                        Player.SendMessage(p, "Woah!! You can't ban a MCDawn Administrator!");
                        if (p != null)
                        {
                            Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " is crazy! Trying to ban a MCDawn Administrator!");
                        }
                        else
                        {
                            Player.GlobalMessage("The Console is crazy! Trying to ban a MCDawn Administrator!");
                        }
                        return;
                    }
                }
            }

            if (opNamesWithThatIP != null && opNamesWithThatIP.Count > 0)
            {
                // We have at least one op+ with a matching IP
                // Check permissions of everybody who matched that IP
                foreach (string opname in opNamesWithThatIP)
                {
                    // If one of these guys is a dev, don't allow the ipban to proceed!
                    if (Server.devs.Contains(opname.ToLower()))
                    {
                        Player.SendMessage(p, "Woah!! You can't ban a MCDawn Developer!");
                        if (p != null)
                        {
                            Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " is crazy! Trying to ban a MCDawn Developer!");
                        }
                        else
                        {
                            Player.GlobalMessage("The Console is crazy! Trying to ban a MCDawn Developer!");
                        }
                        return;
                    }
                    if (Server.staff.Contains(opname.ToLower()))
                    {
                        Player.SendMessage(p, "Woah!! You can't ban a MCDawn Staff Member!");
                        if (p != null)
                        {
                            Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " is crazy! Trying to ban a MCDawn Staff Member!");
                        }
                        else
                        {
                            Player.GlobalMessage("The Console is crazy! Trying to ban a MCDawn Staff Member!");
                        }
                        return;
                    }
                    if (Server.administration.Contains(opname.ToLower()))
                    {
                        Player.SendMessage(p, "Woah!! You can't ban a MCDawn Administrator!");
                        if (p != null)
                        {
                            Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " is crazy! Trying to ban a MCDawn Administrator!");
                        }
                        else
                        {
                            Player.GlobalMessage("The Console is crazy! Trying to ban a MCDawn Administrator!");
                        }
                        return;
                    }
                    // Console can ban anybody else, so skip this section
                    if (p != null)
                    {
                        // If one of these guys matches a player with a higher rank don't allow the ipban to proceed!
                        Group grp = Group.findPlayerGroup(opname);
                        if (grp != null)
                        {
                            if (grp.Permission >= p.group.Permission)
                            {
                                Player.SendMessage(p, "You can only IP-ban IPs of players with a lower rank.");
                                Player.SendMessage(p, Server.DefaultColor + opname + "(" + grp.color + grp.name + Server.DefaultColor + ") also has the IP of " + message + ".");
                                Server.s.Log(p.name + " attempted to IP-ban " + message + " [Player " + opname + "(" + grp.name + ") also has the IP of " + message + "]");
                                return;
                            }
                        }
                    }
                }
            }



            if (p != null)
            {
                IRCBot.Say(message.ToLower() + " is now ip-banned by " + p.name + ".");
                Server.s.Log("IP-BANNED: " + message.ToLower() + " by " + p.name + ".");
                Player.GlobalMessage(message + " is now &8ip-banned" + Server.DefaultColor + " by " + p.color + p.name + Server.DefaultColor + ".");
            }
            else
            {
                IRCBot.Say(message.ToLower() + " is now ip-banned by Console.");
                Server.s.Log("IP-BANNED: " + message.ToLower() + " by Console.");
                Player.GlobalMessage(message + " is now &8ip-banned" + Server.DefaultColor + " by Console.");
            }
            Server.bannedIP.Add(message);
            Server.bannedIP.Save("banned-ip.txt", false);

            /*try {
             *  Player.players.ForEach(delegate(Player pl) {
             *      if (((Player.Find(usingName).ip == pl.ip && pl.name.ToLower() != usingName.ToLower()) || (message == pl.ip)) && pl.group.Permission < p.group.Permission)
             *          pl.Kick("Kicked by ip-ban!");
             *  });
             * }
             * catch { } // try catched for possible enumeration error >.>*/
        }
Пример #4
0
        public override void Use(Player p, string message)
        {
            try
            {
                if (message == "")
                {
                    Help(p); return;
                }
                bool stealth = false; bool totalBan = false;
                if (message[0] == '#')
                {
                    message = message.Remove(0, 1).Trim();
                    stealth = true;
                    Server.s.Log("Stealth Ban Attempted");
                }
                else if (message[0] == '@')
                {
                    totalBan = true;
                    message  = message.Remove(0, 1).Trim();
                }

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

                if (who == null)
                {
                    /*if (!Player.ValidName(message))
                     * {
                     *  Player.SendMessage(p, "Invalid name \"" + message + "\".");
                     *  return;
                     * }*/

                    if (Server.devs.Contains(message.Split(' ')[0].ToLower()))
                    {
                        Player.SendMessage(p, "Woah!! You can't ban a MCDawn Developer!");
                        if (p != null)
                        {
                            Player.GlobalMessage(p.color + p.name + "&g is crazy! Trying to ban a MCDawn Developer!");
                        }
                        else
                        {
                            Player.GlobalMessage("The Console is crazy! Trying to ban a MCDawn Developer!");
                        }
                        return;
                    }
                    if (Server.staff.Contains(message.Split(' ')[0].ToLower()))
                    {
                        Player.SendMessage(p, "Woah!! You can't ban a MCDawn Staff Member!");
                        if (p != null)
                        {
                            Player.GlobalMessage(p.color + p.name + "&g is crazy! Trying to ban a MCDawn Staff Member!");
                        }
                        else
                        {
                            Player.GlobalMessage("The Console is crazy! Trying to ban a MCDawn Staff Member!");
                        }
                        return;
                    }
                    if (Server.administration.Contains(message.Split(' ')[0].ToLower()))
                    {
                        Player.SendMessage(p, "Woah!! You can't ban a MCDawn Administrator!");
                        if (p != null)
                        {
                            Player.GlobalMessage(p.color + p.name + "&g is crazy! Trying to ban a MCDawn Administrator!");
                        }
                        else
                        {
                            Player.GlobalMessage("The Console is crazy! Trying to ban a MCDawn Administrator!");
                        }
                        return;
                    }

                    Group foundGroup = Group.findPlayerGroup(message.Split(' ')[0]);

                    if (foundGroup.Permission >= LevelPermission.Operator)
                    {
                        Player.SendMessage(p, "You can't ban a " + foundGroup.name + "!");
                        return;
                    }
                    if (foundGroup.Permission == LevelPermission.Banned)
                    {
                        Player.SendMessage(p, message.Split(' ')[0] + " is already banned.");
                        return;
                    }
                    if (p != null && foundGroup.Permission >= p.group.Permission)
                    {
                        Player.SendMessage(p, "You cannot ban a person ranked equal or higher than you.");
                        return;
                    }

                    foundGroup.playerList.Remove(message.Split(' ')[0]);
                    foundGroup.playerList.Save();

                    if (p != null)
                    {
                        Player.GlobalMessage(message.Split(' ')[0] + " &f(offline)" + "&g is now &8banned" + "&g by " + p.color + p.name + "&g.");
                    }
                    else
                    {
                        Player.GlobalMessage(message.Split(' ')[0] + " &f(offline)" + "&g is now &8banned" + "&g by Console.");
                    }
                    Group.findPerm(LevelPermission.Banned).playerList.Add(message.Split(' ')[0]);
                    if (message.Trim().Split(' ').Length == 1)
                    {
                        message += " No reason given.";
                    }
                    if (p != null)
                    {
                        if (!message.Substring(message.IndexOf(" ") + 1).ToLower().Contains(p.name.ToLower()))
                        {
                            message += " (" + p.name + ")";
                        }
                    }
                    else
                    {
                        if (!message.Substring(message.IndexOf(" ") + 1).ToLower().Contains("console"))
                        {
                            message += " (Console)";
                        }
                    }
                    MySQL.executeQuery("UPDATE Players SET lastRankReason = '[" + DateTime.Now.ToString() + "] " + message.Substring(message.IndexOf(" ") + 1).Replace("'", "\\'").Trim() + "' WHERE Name = '" + message.Split(' ')[0] + "'");
                    Player.GlobalChat(null, "&6Reason: &f" + message.Substring(message.IndexOf(" ") + 1).Trim(), false);
                }
                else
                {
                    if (!Player.ValidName(who.name))
                    {
                        Player.SendMessage(p, "Invalid name \"" + who.name + "\".");
                        return;
                    }
                    if (Server.devs.Contains(who.originalName.ToLower()))
                    {
                        Player.SendMessage(p, "Woah!! You can't ban a MCDawn Developer!");
                        if (p != null)
                        {
                            Player.GlobalMessage(p.color + p.name + "&g is crazy! Trying to ban an MCDawn Developer!");
                        }
                        else
                        {
                            Player.GlobalMessage("The Console is crazy! Trying to ban an MCDawn Developer!");
                        }
                        return;
                    }
                    if (Server.staff.Contains(who.originalName.ToLower()))
                    {
                        Player.SendMessage(p, "Woah!! You can't ban a MCDawn Staff Member!");
                        if (p != null)
                        {
                            Player.GlobalMessage(p.color + p.name + "&g is crazy! Trying to ban a MCDawn Staff Member!");
                        }
                        else
                        {
                            Player.GlobalMessage("The Console is crazy! Trying to ban a MCDawn Staff Member!");
                        }
                        return;
                    }
                    if (Server.administration.Contains(who.originalName.ToLower()))
                    {
                        Player.SendMessage(p, "Woah!! You can't ban a MCDawn Administrator!");
                        if (p != null)
                        {
                            Player.GlobalMessage(p.color + p.name + "&g is crazy! Trying to ban a MCDawn Administrator!");
                        }
                        else
                        {
                            Player.GlobalMessage("The Console is crazy! Trying to ban a MCDawn Administrator!");
                        }
                        return;
                    }

                    if (who.group.Permission >= LevelPermission.Operator)
                    {
                        Player.SendMessage(p, "You can't ban a " + who.group.name + "!");
                        return;
                    }
                    if (who.group.Permission == LevelPermission.Banned)
                    {
                        Player.SendMessage(p, who.name + " is already banned.");
                        return;
                    }

                    who.group.playerList.Remove(message.Split(' ')[0]);
                    who.group.playerList.Save();

                    if (p != null)
                    {
                        if (stealth)
                        {
                            Player.GlobalMessageOps(who.color + who.name + "&g is now STEALTH &8banned" + "&g by " + p.color + p.name + "&g.");
                        }
                        else
                        {
                            Player.GlobalChat(who, who.color + who.name + "&g is now &8banned" + "&g by " + p.color + p.name + "&g.", false);
                        }
                    }
                    else
                    {
                        if (stealth)
                        {
                            Player.GlobalMessageOps(who.color + who.name + "&g is now STEALTH &8banned" + "&g by Console.");
                        }
                        else
                        {
                            Player.GlobalChat(who, who.color + who.name + "&g is now &8banned" + "&g by Console.", false);
                        }
                    }

                    if (message.Trim().Split(' ').Length == 1)
                    {
                        message += " No reason given.";
                    }
                    if (p != null)
                    {
                        if (!message.Substring(message.IndexOf(" ") + 1).ToLower().Contains(p.name.ToLower()))
                        {
                            message += " (" + p.name + ")";
                        }
                    }
                    else
                    {
                        if (!message.Substring(message.IndexOf(" ") + 1).ToLower().Contains("console"))
                        {
                            message += " (Console)";
                        }
                    }
                    MySQL.executeQuery("UPDATE Players SET lastRankReason = '[" + DateTime.Now.ToString() + "] " + message.Substring(message.IndexOf(" ") + 1).Replace("'", "\\'").Trim() + "' WHERE Name = '" + who.name + "'");
                    who.lastRankReason = "[" + DateTime.Now.ToString() + "] " + message.Substring(message.IndexOf(" ") + 1).Trim();

                    who.group = Group.findPerm(LevelPermission.Banned);
                    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);
                    Group.findPerm(LevelPermission.Banned).playerList.Add(who.name);
                    Player.GlobalChat(null, "&6Reason: &f" + message.Substring(message.IndexOf(" ") + 1).Trim(), false);
                }
                Group.findPerm(LevelPermission.Banned).playerList.Save();

                if (p != null)
                {
                    IRCBot.Say(message.Split(' ')[0] + " is now banned by " + p.name + ".");
                    Server.s.Log("BANNED: " + message.Split(' ')[0].ToLower() + " by " + p.name + ".");
                }
                else
                {
                    IRCBot.Say(message.Split(' ')[0] + " is now banned by Console.");
                    Server.s.Log("BANNED: " + message.Split(' ')[0].ToLower() + " by Console.");
                }

                if (totalBan == true)
                {
                    Command.all.Find("undo").Use(p, message.Split(' ')[0] + " 0");
                    Command.all.Find("banip").Use(p, "@ " + message.Split(' ')[0]);
                }
            }
            catch (Exception e) { Server.ErrorLog(e); }
        }
Пример #5
0
        public override void Use(Player p, string message)
        {
            if (message.Split(' ').Length < 2)
            {
                Help(p); return;
            }
            Player who     = Player.Find(message.Split(' ')[0]);
            Group  newRank = Group.Find(message.Split(' ')[1]);
            string msgGave;

            if (p != null)
            {
                if (message.Split(' ').Length > 2)
                {
                    msgGave = message.Substring(message.IndexOf(' ', message.IndexOf(' ') + 1)) + " (" + p.name + ")";
                }
                else
                {
                    msgGave = "No reason given. (" + p.name + ").";
                }
            }
            else
            if (message.Split(' ').Length > 2)
            {
                msgGave = message.Substring(message.IndexOf(' ', message.IndexOf(' ') + 1)) + " (Console)";
            }
            else
            {
                msgGave = "No reason given. (Console).";
            }
            if (newRank == null)
            {
                Player.SendMessage(p, "Could not find specified rank."); return;
            }

            Group bannedGroup = Group.findPerm(LevelPermission.Banned);

            if (who == null)
            {
                string foundName = message.Split(' ')[0];
                if (newRank == bannedGroup)
                {
                    if (p != null)
                    {
                        Player.GlobalMessage(foundName + " &f(offline)" + Server.DefaultColor + " is now &8banned" + Server.DefaultColor + " by " + p.color + p.name + Server.DefaultColor + ".");
                    }
                    else
                    {
                        Player.GlobalMessage(foundName + " &f(offline)" + Server.DefaultColor + " is now &8banned" + Server.DefaultColor + " by Console.");
                    }
                    return;
                }

                Group oldGroup = Group.findPlayerGroup(foundName);

                Player.GlobalMessage(foundName + " &f(offline)" + Server.DefaultColor + "'s rank was set to " + newRank.color + newRank.name);
                Player.GlobalChat(null, "&6Reason: &f" + msgGave, false);
            }
            else
            {
                if (newRank == bannedGroup)
                {
                    if (p != null)
                    {
                        Player.GlobalChat(who, who.color + who.name + Server.DefaultColor + " is now &8banned" + Server.DefaultColor + " by " + p.color + p.name + Server.DefaultColor + ".", false);
                    }
                    else
                    {
                        Player.GlobalChat(who, who.color + who.name + Server.DefaultColor + " is now &8banned" + Server.DefaultColor + " by Console.", false);
                    }
                    Player.GlobalChat(null, "&6Reason: &f" + msgGave, false);
                    return;
                }
                Player.GlobalChat(who, who.color + who.name + Server.DefaultColor + "'s rank was set to " + newRank.color + newRank.name, false);
                Player.GlobalChat(null, "&6Reason: &f" + msgGave, false);
                who.color = who.group.color;
                Player.GlobalDie(who, false);
                who.SendMessage("You are now ranked " + newRank.color + newRank.name + Server.DefaultColor + ", type /help for your new set of commands.");
                Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false);
            }
        }
Пример #6
0
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                Help(p); return;
            }
            bool totalUnban = false;

            if (message[0] == '@')
            {
                totalUnban = true;
                message    = message.Remove(0, 1).Trim();
            }

            Player who = Player.Find(message);

            if (who == null)
            {
                if (Group.findPlayerGroup(message) != Group.findPerm(LevelPermission.Banned))
                {
                    foreach (Server.TempBan tban in Server.tempBans)
                    {
                        if (tban.name.ToLower() == message.ToLower())
                        {
                            Server.tempBans.Remove(tban);
                            Player.GlobalMessage(message + " has had their temporary ban lifted.");
                            return;
                        }
                    }
                    Player.SendMessage(p, "Player is not banned.");
                    return;
                }
                Player.GlobalMessage(message + " &8(banned)" + "&g is now " + Group.standard.color + Group.standard.name + "&g!");
                Group.findPerm(LevelPermission.Banned).playerList.Remove(message);
            }
            else
            {
                if (Group.findPlayerGroup(message) != Group.findPerm(LevelPermission.Banned))
                {
                    foreach (Server.TempBan tban in Server.tempBans)
                    {
                        if (tban.name == who.name)
                        {
                            Server.tempBans.Remove(tban);
                            Player.GlobalMessage(who.color + who.prefix + who.name + "&ghas had their temporary ban lifted.");
                            return;
                        }
                    }
                    Player.SendMessage(p, "Player is not banned.");
                    return;
                }
                Player.GlobalChat(who, who.color + who.prefix + who.name + "&g is now " + Group.standard.color + Group.standard.name + "&g!", false);
                who.group = Group.standard; 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);
                Group.findPerm(LevelPermission.Banned).playerList.Remove(message);
            }

            Group.findPerm(LevelPermission.Banned).playerList.Save();
            if (totalUnban)
            {
                Command.all.Find("unbanip").Use(p, "@" + message);
            }
        }