Compiling Error -_-

Compiling Error -_-

Postby lucasds12 » 01 Jun 2013, 20:42

Hello, while I was trying to make my command called /pasta, I ran into a compiler error and here is the error:
Code: Select all

Error CS0116
Message: A namespace does not directly contain members such as fields or methods
Line: 47

Here is the code:
Code: Select all
/*
   Auto-generated command skeleton class.

   Use this as a basis for custom commands implemented via the MCDzienny scripting framework.
   File and class should be named a specific way.  For example, /update is named 'CmdUpdate.cs' for the file, and 'CmdUpdate' for the class.
*/

// Add any other using statements you need up here, of course.
// As a note, MCDzienny is designed for .NET 3.5.
using System;

namespace MCDzienny
{
   public class CmdPasta : Command
   {
      // The command's name, in all lowercase.  What you'll be putting behind the slash when using it.
      public override string name { get { return "pasta"; } }

      // Command's shortcut (please take care not to use an existing one, or you may have issues.
      public override string shortcut { get { pasta ""; } }

      // Determines which submenu the command displays in under /help.
      public override string type { get { return "mod"; } }

      // Determines whether or not this command can be used in a museum.  Block/map altering commands should be made false to avoid errors.
      public override bool museumUsable { get { return false; } }

      // Determines the command's default rank.  Valid values are:
      // LevelPermission.Nobody, LevelPermission.Banned, LevelPermission.Guest
      // LevelPermission.Builder, LevelPermission.AdvBuilder, LevelPermission.Operator, LevelPermission.Admin
      public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }

      // This is where the magic happens, naturally.
      // p is the player object for the player executing the command.  message is everything after the command invocation itself.
      public override void Use(Player p, string message)
      {
         Player.SendMessage(p, "Pasta's Here!");
      }

      // This one controls what happens when you use /help [commandname].
      public override void Help(Player p)
      {
         Player.SendMessage(p, "/pasta - Time to spawn the delivery man.");
      }
   }
}
Command.all.Find{botadd Pasta}.Use.(p. message)



It would be a pleasure if you could help!
-Lucas
There is only one thing I do in life, that's contributing here.
lucasds12
 
Posts: 334
Joined: 17 Apr 2013, 16:17
Location: In the deep caves.

Re: Compiling Error -_-

Postby ismellike » 01 Jun 2013, 20:54

Move this "Command.all.Find{botadd Pasta}.Use.(p. message);" into the Use or remove it if you didn't mean to have it there.

If you do move it, it has to look like this Command.all.Find("botadd").Use(p,message);
What a beast...
User avatar
ismellike
Coder
 
Posts: 731
Joined: 31 Oct 2012, 04:04
Location: Kansas

Re: Compiling Error -_-

Postby lucasds12 » 01 Jun 2013, 20:57

ismellike wrote:Move this "Command.all.Find{botadd Pasta}.Use.(p. message);" into the Use or remove it if you didn't mean to have it there.

If you do move it, it has to look like this Command.all.Find("botadd").Use(p,message); and it will work!

Ok! I'll try to compile it now.
There is only one thing I do in life, that's contributing here.
lucasds12
 
Posts: 334
Joined: 17 Apr 2013, 16:17
Location: In the deep caves.

Re: Compiling Error -_-

Postby Warren1001 » 01 Jun 2013, 21:31

Code: Select all
using System;
using System.Threading;
using System.IO;

namespace MCDzienny
{
   public class CmdPasta : Command
   {
      public override string name { get { return "pasta"; } }
      public override string shortcut { get { return ""; } }
      public override string type { get { return "other"; } }
      public override bool museumUsable { get { return false; } }
      public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }

      public override void Use(Player p, string message)
      {
         if (message != "")
         {
            Help(p);
            return;
         }
         else
         {
            Command.all.Find("botadd").Use(p, "Pasta");
            Player.GlobalMessage("Pasta's Here!");
         }
      }
   
      public override void Help(Player p)
      {
         Player.SendMessage(p, "/pasta - Time to spawn the delivery man.");
      }
   }
}

I fixed it for you.
Warren1001
 
Posts: 197
Joined: 08 Aug 2012, 03:50

Re: Compiling Error -_-

Postby lucasds12 » 01 Jun 2013, 21:38

Yay, now I have a pasta command!
-Lucas
There is only one thing I do in life, that's contributing here.
lucasds12
 
Posts: 334
Joined: 17 Apr 2013, 16:17
Location: In the deep caves.


Return to Help in Coding

Who is online

Users browsing this forum: No registered users and 4 guests

cron