/bring - brings a player to your position

/bring - brings a player to your position

Postby HelloWorldCool » 08 Nov 2011, 01:53

This Command is very good because it doesn't allow a lower rank player like an op to summon an admin.

Code:

Code: Select all
/*
   Auto-generated command skeleton class.

   Use this as a basis for custom commands implemented via the MCDzienny scripting framework.
   File and class should be named a specific way.  For example, /update is named 'CmdUpdate.cs' for the file, and 'CmdUpdate' for the class.
*/

// Add any other using statements you need up here, of course.
// As a note, MCDzienny is designed for .NET 3.5.
using System;
using System.IO;
using System.Threading;

namespace MCDzienny
{
    public class CmdBring : Command
    {
        public override string name { get { return "bring"; } }
        public override string shortcut { get { return ""; } }
        public override string type { get { return "other"; } }
        public override bool museumUsable { get { return false; } }
        public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } }
        public CmdBring() { }

        public override void Use(Player p, string message)
        {
            if (message == "") { Help(p); return; }
            if (p == null) { Player.SendMessage(p, "You cannot use this command from the console"); return; }
            if (message.ToLower() == "all")
            {
                try
                {
                    foreach (Player pl in Player.players)
                    {
                        if (pl.level == p.level && pl != p && p.group.Permission > pl.group.Permission)
                        {
                            unchecked { pl.SendPos((byte)-1, p.pos[0], p.pos[1], p.pos[2], p.rot[0], 0); }
                            pl.SendMessage("You were brought by " + p.color + p.name + Server.DefaultColor + ".");
                        }
                    }
                }
                catch (Exception e)
                {
                    Server.ErrorLog(e);
                }
                Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " brought everyone!");
                return;
            }

            Player who = Player.Find(message);
            if (who == null || who.hidden) { Player.SendMessage(p, "There is no player \"" + message + "\"!"); return; }
            if (p.group.Permission < who.group.Permission)
            {
                Player.SendMessage(p, "You cannot bring someone ranked higher than you!");
                return;
            }
            if (p.level != who.level)
            {
                Player.SendMessage(p, who.name + " is in a different Level. Forcefetching has started!");
                Level where = p.level;
                Command.all.Find("goto").Use(who, where.name);
                Thread.Sleep(1000);
                // Sleep for a bit while they load
                while (who.Loading) { Thread.Sleep(250); }
            }

            unchecked { who.SendPos((byte)-1, p.pos[0], p.pos[1], p.pos[2], p.rot[0], 0); }
            who.SendMessage("You were brought by " + p.color + p.name + Server.DefaultColor + ".");
        }
        public override void Help(Player p)
        {
            Player.SendMessage(p, "/bring <player> - Brings a player to your position.");
            Player.SendMessage(p, "/bring all - Brings all players in the map");
        }
    }
}


Hope This Helps! :D
Download fCraft maps! - viewtopic.php?f=25&t=3012!



Note: The Developer(s) of MCDzienny have resigned and the software is no longer supported.
Errors are bound to occur and Mojang has not attempted to resolve them.
User avatar
HelloWorldCool
 
Posts: 867
Joined: 18 Oct 2011, 00:19
Location: MCDzienny Forums, HelloWorldCool Forums

Re: /bring -brings a player to your position.

Postby Ultima » 18 Nov 2011, 10:09

Isnt /fetch or /summon the same thing?
User avatar
Ultima
 
Posts: 953
Joined: 19 Aug 2011, 23:45

Re: /bring -brings a player to your position.

Postby HelloWorldCool » 18 Nov 2011, 21:39

Not exactly this makes it so you can't summon higher ranks than you.

Referring to this Suggestion: http://mcdzienny.cba.pl/viewtopic.php?f=10&t=892&p=3101#p3101
Download fCraft maps! - viewtopic.php?f=25&t=3012!



Note: The Developer(s) of MCDzienny have resigned and the software is no longer supported.
Errors are bound to occur and Mojang has not attempted to resolve them.
User avatar
HelloWorldCool
 
Posts: 867
Joined: 18 Oct 2011, 00:19
Location: MCDzienny Forums, HelloWorldCool Forums


Return to Custom Commands

Who is online

Users browsing this forum: No registered users and 4 guests

cron