Page 1 of 1

Command Hub Help

PostPosted: 23 Nov 2016, 04:56
by Alshima
Yes, I am back, under a new alias. I need a few questions, I started to make a new command for my new server that is Lava Survival/Freebuild. If anyone still checks on this website, with some knowledge in coding please respond, I need assistance amending my code so I can compile it into my server.

I run my server on MCDzienny 11.1.1.0, I haven't updated it based on my fears of the server consistently crashing again, as it has done so before.

I have these specific errors,

Code: Select all
-------------------------

Error #CS0115
Message: 'MCDzienny.CmdLobby.defaultrank': no suitable method found to override
Line: 13

-------------------------

Error #CS0534
Message: 'MCDzienny.CmdLobby' does not implement inherited abstract member 'MCDzienny.Command.defaultRank.get'
Line: 7


Here is my code,

Code: Select all
//FreshMC
//Made by Fresh+
using System;
using System.IO;
namespace MCDzienny
{
   public class CmdLobby : Command
   {
      public override string name { get { return "lobby"; } }
      public override string shortcut { get { return "hub"; } }
      public override string type { get { return "other"; } }
      public override bool museumUsable { get { return false; } }
      public override LevelPermission defaultrank { get { return LevelPermission.Guest; } }
      public override void Use(Player p, string message)
      {
         if (message == "") { Help(p); return: }
         {
         Command.all.Find("goto").Use(p, "hub2");
         }
      }
         public override void Help(Player p)
         {
            Player.SendMessage(p, "/lobby or /hub - Sends you to the main lobby.");
         }
   }
}


Thanks for the help!

-Fresh or Alsh

*moved to another subsection*

Help for new Command

PostPosted: 23 Nov 2016, 04:58
by Alshima
Yes, I am back, under a new alias. I need a few questions, I started to make a new command for my new server that is Lava Survival/Freebuild. If anyone still checks on this website, with some knowledge in coding please respond, I need assistance amending my code so I can compile it into my server.

I run my server on MCDzienny 11.1.1.0, I haven't updated it based on my fears of the server consistently crashing again, as it has done so before.

I have these specific errors,

Code: Select all
-------------------------

Error #CS0115
Message: 'MCDzienny.CmdLobby.defaultrank': no suitable method found to override
Line: 13

-------------------------

Error #CS0534
Message: 'MCDzienny.CmdLobby' does not implement inherited abstract member 'MCDzienny.Command.defaultRank.get'
Line: 7


Here is my code,

Code: Select all
//FreshMC
//Made by Fresh+
using System;
using System.IO;
namespace MCDzienny
{
   public class CmdLobby : Command
   {
      public override string name { get { return "lobby"; } }
      public override string shortcut { get { return "hub"; } }
      public override string type { get { return "other"; } }
      public override bool museumUsable { get { return false; } }
      public override LevelPermission defaultrank { get { return LevelPermission.Guest; } }
      public override void Use(Player p, string message)
      {
         if (message == "") { Help(p); return: }
         {
         Command.all.Find("goto").Use(p, "hub2");
         }
      }
         public override void Help(Player p)
         {
            Player.SendMessage(p, "/lobby or /hub - Sends you to the main lobby.");
         }
   }
}


Thanks for the help!

-Fresh or Alsh

Re: Command Hub Help

PostPosted: 23 Nov 2016, 22:10
by HelloWorldCool
Hi Alshima,

Normally, the response I would give is that the server software is obsolete but in this case since you are using a basic custom command there should be a solution.

I believe that part of the coding is case sensitive in this line:
"public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }"

The fixed version below should work.

Code: Select all
//Made by Fresh+
using System;
using System.IO;
namespace MCDzienny
{
   public class CmdLobby : Command
   {
      public override string name { get { return "lobby"; } }
      public override string shortcut { get { return "hub"; } }
      public override string type { get { return "other"; } }
      public override bool museumUsable { get { return false; } }
      public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
      public override void Use(Player p, string message)
      {
         if (message == "") { Help(p); return: }
         {
         Command.all.Find("goto").Use(p, "hub2");
         }
      }
         public override void Help(Player p)
         {
            Player.SendMessage(p, "/lobby or /hub - Sends you to the main lobby.");
         }
   }
}



Hope this helps <ok>
HelloWorldCool