It is currently July 22nd, 2018, 12:23 pm


All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: /Tpzone
PostPosted: February 3rd, 2012, 4:18 am 

Joined: August 21st, 2011, 6:31 am
Posts: 280
Location: United Kingdom
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.

Show
Code:
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.

_________________
You cannot use certain BBCodes: [img].


Last edited by Jonty800 on May 8th, 2012, 1:45 pm, edited 3 times in total.

Top
Offline Profile  
Reply with quote  
 Post subject: Re: /Tpzone
PostPosted: February 3rd, 2012, 9:15 am 

Joined: May 26th, 2011, 2:15 pm
Posts: 279
I will test it out :)


Top
Offline Profile  
Reply with quote  
 Post subject: Re: /Tpzone
PostPosted: February 3rd, 2012, 9:59 am 
fCraft Developer
User avatar

Joined: May 21st, 2011, 10:53 pm
Posts: 1386
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.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: /Tpzone
PostPosted: February 3rd, 2012, 11:11 am 

Joined: May 26th, 2011, 2:15 pm
Posts: 279
What is the code for "Error message" color?
I know System = &S, Help = &H, and the standard colors.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: /Tpzone
PostPosted: February 3rd, 2012, 2:01 pm 
fCraft Developer
User avatar

Joined: May 21st, 2011, 10:53 pm
Posts: 1386
  • &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)


Top
Offline Profile  
Reply with quote  
 Post subject: Re: /Tpzone
PostPosted: February 3rd, 2012, 2:27 pm 

Joined: May 26th, 2011, 2:15 pm
Posts: 279
Ty fragmer.
I'll write it down somewhere^^


Top
Offline Profile  
Reply with quote  
 Post subject: Re: /Tpzone
PostPosted: February 3rd, 2012, 2:39 pm 

Joined: August 21st, 2011, 6:31 am
Posts: 280
Location: United Kingdom
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 :/

_________________
You cannot use certain BBCodes: [img].


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net