/Tpzone
Posted: February 3rd, 2012, 4:18 am
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.
Works perfectly.
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);
}
}