Error when using command by console

Error when using command by console

Postby Breakdown901 » 13 Jul 2013, 18:05

When I use /torture from console it comes up an error, in-game it is fine. I have forgot the console access piece of code and I was wondering if it was because I didnt have that piece of code that the error is coming up. I think it may be public override bool Consoleacess {get { return true; } }

Heres the code:

Code: Select all
//Made by Breakdown901
using System;
namespace MCDzienny
{
   public class CmdTorture : Command
   {
      public override string name { get { return "torture"; } }
      public override string shortcut { get { return "to"; } }
      public override string type { get { return "other"; } }
      public override bool museumUsable { get { return false; } }
      public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }

      public override void Use(Player p, string message)
      {
         Player who = Player.Find(message);
   
           if (ComparePlayer(who, p))
         {
           
            Command.all.Find("xundo").Use(null, who.PublicName);
            Command.all.Find("jail").Use(p, who.PublicName);
            Command.all.Find("mute").Use(p, who.PublicName);
            Command.all.Find("freeze").Use(p, who.PublicName);
            Command.all.Find("kill").Use(p, who.PublicName);
            Command.all.Find("joker").Use(p, who.PublicName);
            Player.GlobalMessage(who.PublicName + Server.DefaultColor + " just got &ctortured!");
         }
      }
      
        public bool ComparePlayer(Player who, Player p)
        {
            if (who == null || who.hidden)
            {
              Player.SendMessage(p, "Player could not be found.");
              return false;
            }
            if (who.group.Permission >= p.group.Permission)
            {
              Player.SendMessage(p, "Cannot use this command on a player of greater or equal rank.");
              return false;
            }   
            return true;
        }
      public override void Help(Player p)
      {
         Player.SendMessage(p, "/torture - /torture [player]- Tortures the player.");
      }
   }
}
Owner of:
Breakdown901 Lava Survival/Zombie Survival/Freebuild
Host of NeonGaming Lava Survival.
Breakdown901
 
Posts: 320
Joined: 24 May 2013, 12:54

Re: Error when using command by console

Postby Leeizazombie » 13 Jul 2013, 18:07

Strange, i'm able to use custom commands via console
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.


Return to Help in Coding

Who is online

Users browsing this forum: No registered users and 1 guest

cron