Page 1 of 1

/Tpzone

Posted: February 3rd, 2012, 4:18 am
by Jonty800
I know this has been rejected from suggestions in the past, but in case anyone would like this command, here is the source I wrote quite a while back.

Code: Select all

static readonly CommandDescriptor CdTPZone = new CommandDescriptor
        {
            Name = "Tpzone",
            IsConsoleSafe = false,
            Aliases = new[] { "tpz", "zonetp" },
            Category = CommandCategory.World | CommandCategory.Zone,
            Permissions = new[] { Permission.Teleport },
            Help = "Teleports you to the centre of a Zone listed in /Zones.",
            Usage = "/Tpzone ZoneName",
            Handler = TPZone
        };

        static void TPZone(Player player, Command cmd)
        {
            string zoneName = cmd.Next();
            if (zoneName == null){
                player.Message("No zone name specified. See &H/help tpzone");
                return;
            }else{
                Zone zone = player.World.Map.Zones.Find(zoneName);
                if (zone == null){
                    player.MessageNoZone(zoneName);
                    return;
                }
                Position zPos = new Position((((zone.Bounds.XMin + zone.Bounds.XMax) / 2) * 32),
                    (((zone.Bounds.YMin + zone.Bounds.YMax) / 2) * 32),
                    (((zone.Bounds.ZMin + zone.Bounds.ZMax) / 2) + 2) * 32);
                player.TeleportTo((zPos));
                player.Message("&WTeleporting you to zone " + zone.ClassyName);
            }
        }
Works perfectly.

Re: /Tpzone

Posted: February 3rd, 2012, 9:15 am
by BobKare
I will test it out :)

Re: /Tpzone

Posted: February 3rd, 2012, 9:59 am
by fragmer
Tested, works exactly as advertised. One possible bug though - you use "&Z" colorcode in the "No zone name specified." message, that's not one of fCraft's standard ones.

Re: /Tpzone

Posted: February 3rd, 2012, 11:11 am
by BobKare
What is the code for "Error message" color?
I know System = &S, Help = &H, and the standard colors.

Re: /Tpzone

Posted: February 3rd, 2012, 2:01 pm
by fragmer
  • &S - System (default: yellow)
  • &Y - Say (default: green)
  • &H - Help/usage (default: Lime)
  • &R - Rules and announcements (default: green)
  • &P - Private and staff messages (default: aqua)
  • &I - IRC messages (default: purple)
  • &M - /Me messages (default: purple)
  • &W - Warnings and errors (default: red)

Re: /Tpzone

Posted: February 3rd, 2012, 2:27 pm
by BobKare
Ty fragmer.
I'll write it down somewhere^^

Re: /Tpzone

Posted: February 3rd, 2012, 2:39 pm
by Jonty800
Thanks for spotting that lol, it's weird that is says &Z because I copied that bit from CdZoneList back in 0.53x haha.

Edit: I have no idea why there was &Z, was this ever a part of fCraft? I've noticed that its also in some of Glenn's code too, but its not in Color.cs. Hmmm :/