/ophome

/ophome

Postby ane200055 » 26 Jul 2013, 12:12

This is a command like /home but instead of it zoning for you it zones for operators.
So basically if you are a operator on a server you can use this command to make a home that only operators can go to and build on.
/ophome new = Create your new operator home.
/ophome del = deletes your operator home.
/ophome visit = visits your operator home.
...........
Shortcut is /ohome
Code: Select all
//Made by ane200055
//Version v0.1
using System;
using System.Threading;
namespace MCDzienny

{
    public class CmdOphome : Command
    {
      public override string name { get { return "ophome"; } }
      public override string shortcut { get { return "ohome"; } }
      public override string type { get { return "mod"; } }
      public override bool museumUsable { get { return true; } }
      public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
      public override void Use(Player p, string message)
        {         
          if (message == "")
            {
            Help(p);
            return;
            }
            else if (message == "new")
            {
                       Command.all.Find("newlvl").Use(p, p.name + "_OP 128 64 128 flat");
                  Thread.Sleep(1000);
                  Command.all.Find("load").Use(p, p.name + "_OP");
                  Thread.Sleep(1000);
                  Command.all.Find("goto").Use(p, p.name + "_OP");
                  Thread.Sleep(7000);
                  Command.all.Find("pervisit").Use(p, p.name + "_OP operator");
                  Command.all.Find("perbuild").Use(p, p.name + "_OP operator");
            }
         else if (message == "del")
         {
                  Command.all.Find("load").Use(p, p.name + "_OP");
                  Thread.Sleep(1000);
                  Command.all.Find("deletelvl").Use(p, p.name + "_OP");
         }
         else if (message == "visit")
         {
                  Command.all.Find("load").Use(p, p.name + "_OP");
                  Thread.Sleep(1000);
                  Command.all.Find("goto").Use(p, p.name + "_OP");
         }
       
      }

        public override void Help(Player p)
        {
                Player.SendMessage(p, "%e/ophome %bnew %ecreates a home for you as a operator that only operators can go to and build on.");
            Player.SendMessage(p, "%e/ophome %bdel %edeletes your operator home map.");
            Player.SendMessage(p, "%e/ophome %bvisit %etakes you to your operator home map.");
                Player.SendMessage(p, "The also works by doing /ohome.");
        }
    }
}
Website: http://ane200055.co.vu
The Developer of The XtraIRC IRC Client: http://xtrairc.tk
C# coder.
User avatar
ane200055
 
Posts: 98
Joined: 30 Jun 2013, 09:07
Location: United Kingdom

Re: /ophome

Postby joppiesaus » 26 Jul 2013, 12:14

Nice command!
Why is there Thread.Sleep() in it? Anti-lag? If it isn't anti lag or error prevention, you can leave it :)
joppiesaus
 
Posts: 379
Joined: 20 Aug 2012, 07:28
Location: in a obsedian house, with glass in it so i can see the lava!

Re: /ophome

Postby ane200055 » 26 Jul 2013, 12:17

joppiesaus wrote:Nice command!
Why is there Thread.Sleep() in it? Anti-lag? If it isn't anti lag or error prevention, you can leave it :)

Yea, I did the Thead.Sleep(Time); to stop errors happening, which is most likely to happen if someone has bad internet or if there is a server lag.
Website: http://ane200055.co.vu
The Developer of The XtraIRC IRC Client: http://xtrairc.tk
C# coder.
User avatar
ane200055
 
Posts: 98
Joined: 30 Jun 2013, 09:07
Location: United Kingdom

Re: /ophome

Postby Breakdown901 » 26 Jul 2013, 13:45

Great command, great idea! A problem you could encounter though, is that more than 1 player will use this command, making 2 levels called OP_ and leaving one inaccessible. You could make it name it (playernick)_OPHome
But even still, a very good command :)
Owner of:
Breakdown901 Lava Survival/Zombie Survival/Freebuild
Host of NeonGaming Lava Survival.
Breakdown901
 
Posts: 320
Joined: 24 May 2013, 12:54

Re: /ophome

Postby ane200055 » 26 Jul 2013, 14:09

Breakdown901 wrote:Great command, great idea! A problem you could encounter though, is that more than 1 player will use this command, making 2 levels called OP_ and leaving one inaccessible. You could make it name it (playernick)_OPHome
But even still, a very good command :)

LOL, It does that already, if I typed "/ophome new" it will call my operator home map ane200055_OP .
Website: http://ane200055.co.vu
The Developer of The XtraIRC IRC Client: http://xtrairc.tk
C# coder.
User avatar
ane200055
 
Posts: 98
Joined: 30 Jun 2013, 09:07
Location: United Kingdom

Re: /ophome

Postby Clowny » 26 Jul 2013, 17:02

Haha well nice command <ok>
Founder Of MC Classic Hosting Community http://mcclassichosting.webs.com
Founder of MC Classic Software MCReborn http://mcreborn.tk
Professional Hoster and Basic C# Coder
Image
User avatar
Clowny
 
Posts: 112
Joined: 14 Jul 2013, 03:53

Re: /ophome

Postby joppiesaus » 26 Jul 2013, 17:11

I have a suggestion for this awsome command:
Visit someone's else's ophome.
/ophome visit <name guy you want to visit>
Here's the split method in case you get stuck(it will pick the second word):
Code: Select all
Player who = Player.Find(message.Split(' ')[1]);
joppiesaus
 
Posts: 379
Joined: 20 Aug 2012, 07:28
Location: in a obsedian house, with glass in it so i can see the lava!

Re: /ophome

Postby ane200055 » 26 Jul 2013, 19:13

joppiesaus wrote:I have a suggestion for this awsome command:
Visit someone's else's ophome.
/ophome visit <name guy you want to visit>
Here's the split method in case you get stuck(it will pick the second word):
Code: Select all
Player who = Player.Find(message.Split(' ')[1]);

Ok, I might try that maybe as /ophome goto , However I'll have to make it later.
Website: http://ane200055.co.vu
The Developer of The XtraIRC IRC Client: http://xtrairc.tk
C# coder.
User avatar
ane200055
 
Posts: 98
Joined: 30 Jun 2013, 09:07
Location: United Kingdom

Re: /ophome

Postby ane200055 » 27 Jul 2013, 10:55

Ok, Here is an updated version of /ophome ..
This update has added /ophome goto PlayerName .. < That takes you to someone else's operator home.
And a changed command shortcut to /oph ..
Code: Select all
//Made by ane200055
//Version v0.2
using System;
using System.Threading;
namespace MCDzienny

{
    public class CmdOphome : Command
    {
      public override string name { get { return "ophome"; } }
      public override string shortcut { get { return "oph"; } }
      public override string type { get { return "mod"; } }
      public override bool museumUsable { get { return true; } }
      public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
      public override void Use(Player p, string message)
        {         
          if (message == "")
            {
            Help(p);
            return;
            }
            else if (message == "new")
            {
                       Command.all.Find("newlvl").Use(p, p.name + "_OP 128 64 128 flat");
                  Thread.Sleep(1000);
                  Command.all.Find("load").Use(p, p.name + "_OP");
                  Thread.Sleep(1000);
                  Command.all.Find("goto").Use(p, p.name + "_OP");
                  Thread.Sleep(7000);
                  Command.all.Find("pervisit").Use(p, p.name + "_OP operator");
                  Command.all.Find("perbuild").Use(p, p.name + "_OP operator");
            }
         else if (message == "del")
         {
                  Command.all.Find("load").Use(p, p.name + "_OP");
                  Thread.Sleep(1000);
                  Command.all.Find("deletelvl").Use(p, p.name + "_OP");
         }
         else if (message == "visit")
         {
                  Command.all.Find("load").Use(p, p.name + "_OP");
                  Thread.Sleep(1000);
                  Command.all.Find("goto").Use(p, p.name + "_OP");
         }
       else if (message == "goto")
       {
      
       }
       Player who = Player.Find(message.Split(' ')[1]);
       {
            Command.all.Find("load").Use(p, who.name + "_OP");
            Thread.Sleep(1000);
            Command.all.Find("goto").Use(p, who.name + "_OP");
      }
       
      }

        public override void Help(Player p)
        {
            Player.SendMessage(p, "%e/ophome %bnew %ecreates a home for you as a operator that only operators can go to and build on.");
            Player.SendMessage(p, "%e/ophome %bdel %edeletes your operator home map.");
            Player.SendMessage(p, "%e/ophome %bvisit %etakes you to your operator home map.");
         Player.SendMessage(p, "%e/ophome %bgoto PlayerName %etakes you to someone else's operator home map.");
            Player.SendMessage(p, "%eThe also works by doing /oph.");
        }
    }
}
Website: http://ane200055.co.vu
The Developer of The XtraIRC IRC Client: http://xtrairc.tk
C# coder.
User avatar
ane200055
 
Posts: 98
Joined: 30 Jun 2013, 09:07
Location: United Kingdom

Re: /ophome

Postby joppiesaus » 27 Jul 2013, 11:20

ane200055 wrote:Ok, Here is an updated version of /ophome ..
This update has added /ophome goto PlayerName .. < That takes you to someone else's operator home.
And a changed command shortcut to /oph ..
Code: Select all
//Made by ane200055
//Version v0.2
using System;
using System.Threading;
namespace MCDzienny

{
    public class CmdOphome : Command
    {
      public override string name { get { return "ophome"; } }
      public override string shortcut { get { return "oph"; } }
      public override string type { get { return "mod"; } }
      public override bool museumUsable { get { return true; } }
      public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
      public override void Use(Player p, string message)
        {         
          if (message == "")
            {
            Help(p);
            return;
            }
            else if (message == "new")
            {
                       Command.all.Find("newlvl").Use(p, p.name + "_OP 128 64 128 flat");
                  Thread.Sleep(1000);
                  Command.all.Find("load").Use(p, p.name + "_OP");
                  Thread.Sleep(1000);
                  Command.all.Find("goto").Use(p, p.name + "_OP");
                  Thread.Sleep(7000);
                  Command.all.Find("pervisit").Use(p, p.name + "_OP operator");
                  Command.all.Find("perbuild").Use(p, p.name + "_OP operator");
            }
         else if (message == "del")
         {
                  Command.all.Find("load").Use(p, p.name + "_OP");
                  Thread.Sleep(1000);
                  Command.all.Find("deletelvl").Use(p, p.name + "_OP");
         }
         else if (message == "visit")
         {
                  Command.all.Find("load").Use(p, p.name + "_OP");
                  Thread.Sleep(1000);
                  Command.all.Find("goto").Use(p, p.name + "_OP");
         }
       else if (message == "goto")
       {
      
       }
       Player who = Player.Find(message.Split(' ')[1]);
       {
            Command.all.Find("load").Use(p, who.name + "_OP");
            Thread.Sleep(1000);
            Command.all.Find("goto").Use(p, who.name + "_OP");
      }
       
      }

        public override void Help(Player p)
        {
            Player.SendMessage(p, "%e/ophome %bnew %ecreates a home for you as a operator that only operators can go to and build on.");
            Player.SendMessage(p, "%e/ophome %bdel %edeletes your operator home map.");
            Player.SendMessage(p, "%e/ophome %bvisit %etakes you to your operator home map.");
         Player.SendMessage(p, "%e/ophome %bgoto PlayerName %etakes you to someone else's operator home map.");
            Player.SendMessage(p, "%eThe also works by doing /oph.");
        }
    }
}


This wont work correctly.
First of all, the if block is messed up(the code is not in the brackets).
Code: Select all
       else if (message == "goto")
       {
      
       }
       Player who = Player.Find(message.Split(' ')[1]);
       {
            Command.all.Find("load").Use(p, who.name + "_OP");
            Thread.Sleep(1000);
            Command.all.Find("goto").Use(p, who.name + "_OP");
      }


also, this is not error proof. Let me fix these problems for you!
Code: Select all
       else if (message == "goto")
       {
          Player who = Player.Find(message.Split(' ')[1]);
                    Level lvl = Level.Find(
                    if (who == null)
                    {
                       Player.GlobalMessage(p, "Player not found!");
                       return;
                    }
                    else
                    {
                       Level lvl = Level.Find(who.name + "_OP");
                       if (lvl != null)
                       {
                 Command.all.Find("load").Use(p, who.name + "_OP");
            Thread.Sleep(1000);
            Command.all.Find("goto").Use(p, who.name + "_OP");
                       }
                       else
                       {
                                Player.GlobalMessage(p, "This player has no ophome!");
                                return;
                       }
                    }
       }


I am not usre if Player.GlobalMessage is a method spelled correctly, so you have to fix that your own! Good luck, and nice made! :)
EDIT: the code block seems to mess up tabs and spaces.
joppiesaus
 
Posts: 379
Joined: 20 Aug 2012, 07:28
Location: in a obsedian house, with glass in it so i can see the lava!

Next

Return to Custom Commands

Who is online

Users browsing this forum: No registered users and 1 guest

cron