Pluton.Player.Ban C# (CSharp) Method

Ban() public method

public Ban ( string reason = "no reason" ) : void
reason string
return void
        public void Ban(string reason = "no reason")
        {
            ServerUsers.Set(GameID, ServerUsers.UserGroup.Banned, Name, reason);
            ServerUsers.Save();
            Kick("[BAN] " + reason);
        }

Usage Example

Esempio n. 1
0
        public static void ban(ConsoleSystem.Arg arg)
        {
            Player player = Player.Find(arg.ArgsStr);

            if (player != null)
            {
                string nameFrom;
                if (arg.connection != null && arg.connection.username != null)
                {
                    nameFrom = arg.connection.username;
                }
                else
                {
                    nameFrom = "RCON";
                }

                player.Ban("Banned by: " + nameFrom);
                Server.GetServer().Broadcast(arg.ArgsStr + " is banned from the server by " + nameFrom + "!");
                arg.ReplyWith(arg.ArgsStr + " is banned!");
            }
            else
            {
                arg.ReplyWith("Couldn't find player: " + arg.ArgsStr);
            }
        }