[Requested] /pillar [Height] - makes a pillar with height

[Requested] /pillar [Height] - makes a pillar with height

Postby tommyz_ » 20 May 2014, 08:57

This command was requested by Leeizazombie. Here ya go as requested. Enjoy!

Code: Select all
//created by tommyz_
using System;
using System.Collections.Generic;

namespace MCDzienny
{
    public class CmdPillar : Command
    {
        public override string name { get { return "pillar"; } }
        public override string shortcut { get { return "pil"; } }
        public override string type { get { return "build"; } }
        public override bool museumUsable { get { return false; } }
        public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } }
        public CmdPillar() { }

        public override void Use(Player p, string message)
        {
            if (message == "") { Help(p); return; }

            int num = 0;
            //test that message is a number
            try { num = Convert.ToInt32(message); }
            catch { Player.SendMessage(p, "Sorry you must only enter a number.");return; }
            if (num > 128)
            { Player.SendMessage(p, "You may only enter a value that is between 1 and 128."); }

            //get position of the player:
            ushort x1 = 0; ushort y1 = 0; ushort z1 = 0;
            x1 = (ushort)(p.pos[0] / 32);
            y1 = (ushort)((p.pos[1] / 32) - 1);
            z1 = (ushort)(p.pos[2] / 32);

            //I didn't do cuboid here because in some situations you would be clicking off the map and
            //it simply will not work that way
            //and ahhh it kinda spams the chat, I wish this software had bool silent = false;
            for (int i = 0; i <= num; i++)
            {
                Command.all.Find("line").Use(p, "stone"); //line
                Command.all.Find("click").Use(p, (x1) + " " + (y1) + " " + (z1));
                Command.all.Find("click").Use(p, (x1) + " " + (y1 + i) + " " + (z1));
            }
           
           
            Player.SendMessage(p, "&aPillar Completed!");
        }
        public override void Help(Player p)
        {
            Player.SendMessage(p, "/pillar [amount] - makes pillar [amount] high.");         
        }
    }
}
tommyz_
 
Posts: 12
Joined: 17 May 2014, 02:46

Re: [Requested] /pillar [Height] - makes a pillar with heigh

Postby Leeizazombie » 23 May 2014, 16:48

I've actually made my own pillar maker in the core code of the open source ClassiCube client, the only problem is servers preventing the click distance, but that was bypassed on my own server because it's basically the only server I use now but I used this:

Code: Select all
if (pillar)
                    {
                        int hits = blockstopillar;
                        while (hits > 0)
                        {
                            networkManager.sendBlockChange(x, y, z, button, blockID);
                            y++;
                            hits--;
                        }
                    }


And the same idea could be used in MCDzienny to prevent the spam problem! :)

Example:

Code: Select all
p.level.Blockchange(p, x, y, z, this.blocktoplace);


I appreciate your help!
Owner of:
LeeIzaZombie Freebuild and Lava Survival V2 (Shut Down and updated)
LeeIzaZombie Survival (Comming back soon)

Contact:
Skype: leeizazombie
IRC: irc.geekshed.net, #leeizazombie, #mcclassichosting
User avatar
Leeizazombie
 
Posts: 536
Joined: 10 Jun 2013, 17:45
Location: Ireland.

Re: [Requested] /pillar [Height] - makes a pillar with heigh

Postby tommyz_ » 27 May 2014, 02:11

Cool! Good job!
tommyz_
 
Posts: 12
Joined: 17 May 2014, 02:46


Return to Custom Commands

Who is online

Users browsing this forum: No registered users and 1 guest

cron