Page 1 of 1

[REJECTED] command to remove drawing permissions from a user

Posted: August 30th, 2011, 7:35 pm
by Jonty800
I think it'll be good to have a command that remove all drawing privileges from a user.
Maybe a hidden command for highest rank?

I think it will be a good solution to things like sphere spam without having to separate drawing commands into different permissions.

Code: Select all

public bool StopDraw;
        public bool StartDraw;
        public string StopDrawBy = "";
public bool StopDrawing(string by)
        {
            if (by == null) throw new ArgumentNullException("by");
            if (!StopDraw)
            {
                StopDraw = true;
                StopDrawBy = by;
                return true;
            }
            else
            {
                return false;
            }
        }


        public bool StartDrawing()
        {
            if (StopDraw)
            {
                StopDraw = false;
                return true;
            }
            else
            {
                return false;
            }
        }

Code: Select all

static readonly CommandDescriptor CdStopDraw = new CommandDescriptor
            {
                Name = "removedraw",
                Category = CommandCategory.Moderation,
                IsConsoleSafe = true,
                Permissions = new[] { Permission.Disconnect },
                Help = "Disables drawing commands from a seclected player.  To undo, use /allowdraw PlayerName",
                Usage = "/removedraw PlayerName",
                Handler = StopDraw
            };

            internal static void StopDraw(Player player, Command cmd)
            {
                string name = cmd.Next();
                if (name == null)
                {
                    CdStopDraw.PrintUsage(player);
                    return;
                }

                Player target = Server.FindPlayerOrPrintMatches(player, name, false);
                if (target == null) return;

                if (player.Can(Permission.Disconnect, target.Info.Rank))
                {
                    target.Info.IsHidden = false;
                    if (target.Info.StopDrawing(player.Name))
                    {
                        Server.Message("{0}&S had their drawing commands disabled by {1}",
                                          target.ClassyName, player.ClassyName);
                        
                    }
                    else
                    {
                        player.Message("{0}&s already had their drawing commands disabled", target.ClassyName);
                    }
                }
                else
                {
                    player.Message("You can only use /removedraw on players ranked {0}&S or lower",
                                    player.Info.Rank.GetLimit(Permission.Ban).ClassyName);
                    player.Message("{0}&S is ranked {1}", target.ClassyName, target.Info.Rank.ClassyName);
                }
            }

            static readonly CommandDescriptor CdStartDraw = new CommandDescriptor
            {
                Name = "allowdraw",

                Category = CommandCategory.Moderation,
                IsConsoleSafe = true,
                Permissions = new[] { Permission.Disconnect },
                Usage = "/allowdraw PlayerName",
                Help = "",
                Handler = StartDraw
            };

            internal static void StartDraw(Player player, Command cmd)
            {
                string name = cmd.Next();
                if (name == null)
                {
                    CdUnWarn.PrintUsage(player);
                    return;
                }

                Player target = Server.FindPlayerOrPrintMatches(player, name, false);
                if (target == null) return;

                if (player.Can(Permission.Disconnect, target.Info.Rank))
                {
                    if (target.Info.StartDrawing())
                    {
                        Server.Message("{0}&S had their drawing commands enabled by {1}.", target.ClassyName, player.ClassyName);
                    }
                    else
                    {
                        player.Message("{0}&S can already use drawing commands.", target.ClassyName);
                    }
                }
                else
                {
                    player.Message("You can only use /allowdraw on players ranked {0}&S or lower",
                                    player.Info.Rank.GetLimit(Permission.Ban).ClassyName);
                    player.Message("{0}&S is ranked {1}", target.ClassyName, target.Info.Rank.ClassyName);
                }
            }

Code: Select all

if (player.Info.StopDraw)
            {
                player.Message("&SYour drawing commands are disabled");
                return;
            }
also: make it so when a player is banned, they are first unfrozen to remove the blue star.

Re: A command to remove drawing permissions from a user

Posted: August 30th, 2011, 9:40 pm
by fragmer
I think the rank system is flexible enough without this special-purpose command :<

Re: A command to remove drawing permissions from a user

Posted: August 30th, 2011, 9:55 pm
by cdferg
Do you mean like, if I wanted to take /banall from fragmer, something like /remove banall fragmer would do the trick?

Re: A command to remove drawing permissions from a user

Posted: August 30th, 2011, 10:36 pm
by Jonty800
It could be developed into something like that.

It was suggested by one of my admins, so I made it and forwarded on the suggestion :P

Re: A command to remove drawing permissions from a user

Posted: August 30th, 2011, 11:13 pm
by Sanjar Khan
Jonty800 wrote:I think it'll be good to have a command that remove all drawing privileges from a user.
/demote Jonty800 guest "Multi-level marketing"
Jonty800 wrote: also: make it so when a player is banned, they are first unfrozen to remove the blue star.
Why, he's banned.

Re: A command to remove drawing permissions from a user

Posted: August 31st, 2011, 2:48 am
by fragmer
Jonty800 wrote:also: make it so when a player is banned, they are first unfrozen to remove the blue star.
I fixed that. In r918+, banned players are automatically unhidden/unmuted/unfrozen. Next time you spot a bug though, please make a separate thread in the Bugs section. Makes it easier to track fixed bugs.

Re: A command to remove drawing permissions from a user

Posted: August 31st, 2011, 3:44 am
by fragmer
I'm also looking into the ability to revoke individual permissions (not commands) from individual players. I'll see if there's enough demand from it.

Re: A command to remove drawing permissions from a user

Posted: August 31st, 2011, 6:02 am
by Jonty800
"Commit by fragmer :: r918 /branch-0.60x/fCraft/ (4 files in 3 dirs):
Added /st as an alias for /staff. No longer allowed to /mute for 0 seconds.
Players are not automatically unhidden, unfrozen, and unmuted on-ban. "

Thanks Fragmer :D :D