示例#1
0
        public static void ban(ConsoleSystem.Arg arg)
        {
            BasePlayer player = arg.GetPlayer(0);

            if (!Object.op_Implicit((Object)player) || player.net == null || player.net.get_connection() == null)
            {
                arg.ReplyWith("Player not found");
            }
            else
            {
                ServerUsers.User user = ServerUsers.Get(player.userID);
                if (user != null && user.group == ServerUsers.UserGroup.Banned)
                {
                    arg.ReplyWith("User " + (object)player.userID + " is already banned");
                }
                else
                {
                    string notes = arg.GetString(1, "No Reason Given");
                    ServerUsers.Set(player.userID, ServerUsers.UserGroup.Banned, player.displayName, notes);
                    string str = "";
                    if (player.IsConnected && player.net.get_connection().ownerid != player.net.get_connection().userid)
                    {
                        str = str + " and also banned ownerid " + (object)(ulong)player.net.get_connection().ownerid;
                        ServerUsers.Set((ulong)player.net.get_connection().ownerid, ServerUsers.UserGroup.Banned, player.displayName, arg.GetString(1, "Family share owner of " + (object)(ulong)player.net.get_connection().userid));
                    }
                    ServerUsers.Save();
                    arg.ReplyWith("Kickbanned User: "******" - " + player.displayName + str);
                    Chat.Broadcast("Kickbanning " + player.displayName + " (" + notes + ")", "SERVER", "#eee", 0UL);
                    ((Server)Net.sv).Kick(player.net.get_connection(), "Banned: " + notes);
                }
            }
        }
示例#2
0
        private void Ban(ConsoleSystem.Arg args)
        {
            BasePlayer player = args.GetPlayer(0);

            if (player == null || player.net == null)
            {
                return;
            }

            string name   = args.GetString(1, "unnamed");
            string reason = args.GetString(2, "no reason");

            var user = ServerUsers.Get(player.userID);

            if (user != null)
            {
                if (UsernameValid(player.userID, name))
                {
                    name = user.username;
                }
            }
            user.group = ServerUsers.UserGroup.Banned;

            if (Settings.Instance.PushedAllLocalBansToDatabase)
            {
                PushBansToServer();
            }
        }
示例#3
0
 public static void teleport(ConsoleSystem.Arg args)
 {
     if (args.HasArgs(2))
     {
         BasePlayer player = args.GetPlayer(0);
         if (!Object.op_Implicit((Object)player) || !player.IsAlive())
         {
             return;
         }
         BasePlayer playerOrSleeper = args.GetPlayerOrSleeper(1);
         if (!Object.op_Implicit((Object)playerOrSleeper) || !playerOrSleeper.IsAlive())
         {
             return;
         }
         player.Teleport(playerOrSleeper);
     }
     else
     {
         BasePlayer basePlayer = args.Player();
         if (!Object.op_Implicit((Object)basePlayer) || !basePlayer.IsAlive())
         {
             return;
         }
         BasePlayer playerOrSleeper = args.GetPlayerOrSleeper(0);
         if (!Object.op_Implicit((Object)playerOrSleeper) || !playerOrSleeper.IsAlive())
         {
             return;
         }
         basePlayer.Teleport(playerOrSleeper);
     }
 }
示例#4
0
        public static void ban(ConsoleSystem.Arg arg)
        {
            BasePlayer player = arg.GetPlayer(0);

            if (!player || player.net == null || player.net.connection == null)
            {
                arg.ReplyWith("Player not found");
                return;
            }
            ServerUsers.User user = ServerUsers.Get(player.userID);
            if (user != null && user.@group == ServerUsers.UserGroup.Banned)
            {
                arg.ReplyWith(string.Concat("User ", player.userID, " is already banned"));
                return;
            }
            string str = arg.GetString(1, "No Reason Given");

            ServerUsers.Set(player.userID, ServerUsers.UserGroup.Banned, player.displayName, str);
            string str1 = "";

            if (player.IsConnected && player.net.connection.ownerid != player.net.connection.userid)
            {
                str1 = string.Concat(str1, " and also banned ownerid ", player.net.connection.ownerid);
                ServerUsers.Set(player.net.connection.ownerid, ServerUsers.UserGroup.Banned, player.displayName, arg.GetString(1, string.Concat("Family share owner of ", player.net.connection.userid)));
            }
            ServerUsers.Save();
            arg.ReplyWith(string.Concat(new object[] { "Kickbanned User: "******" - ", player.displayName, str1 }));
            Chat.Broadcast(string.Concat(new string[] { "Kickbanning ", player.displayName, " (", str, ")" }), "SERVER", "#eee", (ulong)0);
            Network.Net.sv.Kick(player.net.connection, string.Concat("Banned: ", str));
        }
示例#5
0
        public static void unmutevoice(ConsoleSystem.Arg arg)
        {
            BasePlayer player = arg.GetPlayer(0);

            if (!player || player.net == null || player.net.connection == null)
            {
                arg.ReplyWith("Player not found");
                return;
            }
            player.SetPlayerFlag(BasePlayer.PlayerFlags.VoiceMuted, false);
        }
示例#6
0
        public static void mutechat(ConsoleSystem.Arg arg)
        {
            BasePlayer player = arg.GetPlayer(0);

            if (!player || player.net == null || player.net.connection == null)
            {
                arg.ReplyWith("Player not found");
                return;
            }
            player.SetPlayerFlag(BasePlayer.PlayerFlags.ChatMute, true);
        }
示例#7
0
        public static void unmutechat(ConsoleSystem.Arg arg)
        {
            BasePlayer player = arg.GetPlayer(0);

            if (!Object.op_Implicit((Object)player) || player.net == null || player.net.get_connection() == null)
            {
                arg.ReplyWith("Player not found");
            }
            else
            {
                player.SetPlayerFlag(BasePlayer.PlayerFlags.ChatMute, false);
            }
        }
示例#8
0
        public static void kick(ConsoleSystem.Arg arg)
        {
            BasePlayer player = arg.GetPlayer(0);

            if (!player || player.net == null || player.net.connection == null)
            {
                arg.ReplyWith("Player not found");
                return;
            }
            string str = arg.GetString(1, "no reason given");

            arg.ReplyWith(string.Concat("Kicked: ", player.displayName));
            Chat.Broadcast(string.Concat(new string[] { "Kicking ", player.displayName, " (", str, ")" }), "SERVER", "#eee", (ulong)0);
            player.Kick(string.Concat("Kicked: ", arg.GetString(1, "No Reason Given")));
        }
示例#9
0
        public static void kick(ConsoleSystem.Arg arg)
        {
            BasePlayer player = arg.GetPlayer(0);

            if (!Object.op_Implicit((Object)player) || player.net == null || player.net.get_connection() == null)
            {
                arg.ReplyWith("Player not found");
            }
            else
            {
                string str = arg.GetString(1, "no reason given");
                arg.ReplyWith("Kicked: " + player.displayName);
                Chat.Broadcast("Kicking " + player.displayName + " (" + str + ")", "SERVER", "#eee", 0UL);
                player.Kick("Kicked: " + arg.GetString(1, "No Reason Given"));
            }
        }
示例#10
0
        public static void teleport2me(ConsoleSystem.Arg args)
        {
            BasePlayer player1 = args.GetPlayer(0);

            if (!Object.op_Implicit((Object)player1) || !player1.IsAlive())
            {
                return;
            }
            BasePlayer player2 = args.Player();

            if (!Object.op_Implicit((Object)player2) || !player2.IsAlive())
            {
                return;
            }
            player1.Teleport(player2);
        }
示例#11
0
        public static void teleport(ConsoleSystem.Arg args)
        {
            if (!args.HasArgs(2))
            {
                BasePlayer basePlayer = args.Player();
                if (!basePlayer)
                {
                    return;
                }
                if (!basePlayer.IsAlive())
                {
                    return;
                }
                BasePlayer playerOrSleeper = args.GetPlayerOrSleeper(0);
                if (!playerOrSleeper)
                {
                    return;
                }
                if (!playerOrSleeper.IsAlive())
                {
                    return;
                }
                basePlayer.Teleport(playerOrSleeper);
                return;
            }
            BasePlayer player = args.GetPlayer(0);

            if (!player)
            {
                return;
            }
            if (!player.IsAlive())
            {
                return;
            }
            BasePlayer playerOrSleeper1 = args.GetPlayerOrSleeper(1);

            if (!playerOrSleeper1)
            {
                return;
            }
            if (!playerOrSleeper1.IsAlive())
            {
                return;
            }
            player.Teleport(playerOrSleeper1);
        }
示例#12
0
        object OnServerCommand(ConsoleSystem.Arg arg)
        {
            if (arg == null || arg.cmd == null)
            {
                return(null);
            }
            string command = arg.cmd.Name;
            string reason  = arg.GetString(1).ToString();

            if (command.Equals("ban") || command.Equals("banid"))
            {
                if (UseFauxAdminBanBlocker && reason.Equals("Cheat Detected!"))
                {
                    BasePlayer player = arg.GetPlayer(0);
                    if ((player) && isAllowed(player, "fauxadmin.allowed"))
                    {
                        PrintWarning($"FauxAdmin Ban Blocker stopped a ban of " + player.ToString() + " for " + reason);
                        return(false);
                    }
                }
            }
            return(null);
        }
示例#13
0
        public static void teleport2me(ConsoleSystem.Arg args)
        {
            BasePlayer player = args.GetPlayer(0);

            if (!player)
            {
                return;
            }
            if (!player.IsAlive())
            {
                return;
            }
            BasePlayer basePlayer = args.Player();

            if (!basePlayer)
            {
                return;
            }
            if (!basePlayer.IsAlive())
            {
                return;
            }
            player.Teleport(basePlayer);
        }