/hide (rewritting to include welcome/farewell messages)

/hide (rewritting to include welcome/farewell messages)

Postby Warren1001 » 03 Jun 2013, 23:02

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

Error #CS0642
Message: Possible mistaken empty statement
Line: 24

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

Error #CS0103
Message: The name 'dataTable' does not exist in the current context
Line: 28

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

Error #CS0103
Message: The name 'index' does not exist in the current context
Line: 28

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

Error #CS1501
Message: No overload for method 'GlobalSpawn' takes '7' arguments
Line: 50

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

Error #CS1061
Message: 'MCDzienny.Group' does not contain a definition for 'farewellMessage' and no extension method 'farewellMessage' accepting a first argument of type 'MCDzienny.Group' could be found (are you missing a using directive or an assembly reference?)
Line: 65

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

Error #CS1501
Message: No overload for method 'GlobalChat' takes '4' arguments
Line: 65

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

Error #CS1501
Message: No overload for method 'GlobalSpawn' takes '7' arguments
Line: 70

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

Error #CS1061
Message: 'MCDzienny.Group' does not contain a definition for 'welcomeMessage' and no extension method 'welcomeMessage' accepting a first argument of type 'MCDzienny.Group' could be found (are you missing a using directive or an assembly reference?)
Line: 72

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

Error #CS1501
Message: No overload for method 'GlobalChat' takes '4' arguments
Line: 72

Command:
Code: Select all
using System;
using System.Data;
using System.IO;
namespace MCDzienny
{
    public class CmdHide : Command
    {
      public override string name { get { return "hide"; } }
      public override string shortcut { get { return ""; } }
      public override string type { get { return "mod"; } }
      public override bool museumUsable { get { return false; } }
      public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
      public override bool ConsoleAccess { get { return false; } }
     
      public override void Use(Player p, string message)
      {
         if (p.possess != "")
         {
            Player.SendMessage(p, "Stop your current possession first.");
            return;
         }
         else
         {
            using (DataTable dataTable = DBInterface.fillData("SELECT * FROM `Players`"));
            string split0 = message.Split(' ')[0];
            string split1 = message.Split(' ')[1];
            string split2 = message.Split(' ')[2];
            string person = dataTable.Rows[index]["Name"].ToString();
            p.hidden = !p.hidden;
            
            if (split2 != "")
            {
               Help(p);
               return;
            }
            if (split0 == "s")
            {
               if (split1 != "")
               {
                  Help(p);
                  return;
               }
               if (p.hidden)
               {
                  Player.GlobalDie(p, true);
                  Player.SendMessage(p, Server.DefaultColor + "You're now secretly" + " &finvisible" + Server.DefaultColor + ".");
               }
               else
               {
                  Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false);
                  Player.SendMessage(p, Server.DefaultColor + "You're now secretly" + " &fvisible" + Server.DefaultColor + ".");
               }
            }
            else
            {
               if (split0 != "")
               {
                  Help(p);
                  return;
               }
               if (p.hidden)
               {
                  Player.GlobalDie(p, true);
                  Player.GlobalMessageOps("To Ops -" + p.color + p.name + "-" + Server.DefaultColor + " is now &finvisible" + Server.DefaultColor + ".");
                  Player.GlobalChat(p, "&c- " + p.color + p.prefix + p.name + " {0}", (object)(Group.findPlayerGroup(person).farewellMessage), false);
                  Player.SendMessage(p, Server.DefaultColor + "You're now" + " &finvisible" + Server.DefaultColor + ".");
               }
               else
               {
                  Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false);
                  Player.GlobalMessageOps("To Ops -" + p.color + p.name + "-" + Server.DefaultColor + " is now &8visible" + Server.DefaultColor + ".");
                  Player.GlobalChat(p, "&a+ " + p.color + p.prefix + p.name + " {0}", (object)(Group.findPlayerGroup(person).welcomeMessage), false);
                  Player.SendMessage(p, Server.DefaultColor + "You're now" + " &fvisible" + Server.DefaultColor + ".");
               }
            }
         }
      }
      public override void Help(Player p)
      {
         Player.SendMessage(p, "/hide - makes yourself (in)visible to other players.");
      }
   }
}

I used some code from MCLawl which probably isn't any good...
Warren1001
 
Posts: 197
Joined: 08 Aug 2012, 03:50

Re: /hide (rewritting to include welcome/farewell messages)

Postby lucasds12 » 03 Jun 2013, 23:28

For this, you need to override /hide because it is already a made command so you need to override the command and here is the method you use:
Code: Select all
Command.all.Remove(Command.all.Find("hide")

Use that somewhere in your code and hopefully something should result.
-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: /hide (rewritting to include welcome/farewell messages)

Postby ismellike » 03 Jun 2013, 23:30

Here you go, make sure to do what lucas said first.
Spoiler:
What a beast...
User avatar
ismellike
Coder
 
Posts: 731
Joined: 31 Oct 2012, 04:04
Location: Kansas

Re: /hide (rewritting to include welcome/farewell messages)

Postby Warren1001 » 03 Jun 2013, 23:37

lucasds12 wrote:For this, you need to override /hide because it is already a made command so you need to override the command and here is the method you use:
Code: Select all
Command.all.Remove(Command.all.Find("hide")

Use that somewhere in your code and hopefully something should result.
-Lucas

Ty, I completely forgot about that.
ismellike wrote:Here you go, make sure to do what lucas said first.
Spoiler:

Ty :p
Warren1001
 
Posts: 197
Joined: 08 Aug 2012, 03:50

Re: /hide (rewritting to include welcome/farewell messages)

Postby lucasds12 » 03 Jun 2013, 23:41

Warren1001 wrote:
lucasds12 wrote:For this, you need to override /hide because it is already a made command so you need to override the command and here is the method you use:
Code: Select all
Command.all.Remove(Command.all.Find("hide")

Use that somewhere in your code and hopefully something should result.
-Lucas

Ty, I completely forgot about that.
ismellike wrote:Here you go, make sure to do what lucas said first.
Spoiler:

Ty :p

No problem, all of us assist each others always ;)
Just don't forget to use the method below when your making a command that has the same name as a core command ;)
Code: Select all
Command.all.Remove(Command.all.Find("hide")

Now, have a good time with your 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.

Re: /hide (rewritting to include welcome/farewell messages)

Postby ismellike » 03 Jun 2013, 23:48

You have to have

Code: Select all
Command.all.Remove(Command.all.Find("hide")


In its own separate command.

Otherwise, to have the command removed, you need to have the command loaded first.
What a beast...
User avatar
ismellike
Coder
 
Posts: 731
Joined: 31 Oct 2012, 04:04
Location: Kansas

Re: /hide (rewritting to include welcome/farewell messages)

Postby Warren1001 » 03 Jun 2013, 23:50

Errors:
Spoiler:

Command:
Spoiler:
Warren1001
 
Posts: 197
Joined: 08 Aug 2012, 03:50

Re: /hide (rewritting to include welcome/farewell messages)

Postby lucasds12 » 03 Jun 2013, 23:58

It seems you are using a method from MCForge or MCDawn and it doesn't work properly on MCDzienny, it may be from another software and it uses a method that MCDzienny no longer has or it never had.
It has something to do with the "GlobalSpawn" and when I find out this error, I wholeheartedly will tell you why it is not working, I will edit this comment when I find the solution to this problem.

EDIT: Yep, there's a method that comes from a different software and is in there.
-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: /hide (rewritting to include welcome/farewell messages)

Postby Warren1001 » 04 Jun 2013, 00:16

lucasds12 wrote:It seems you are using a method from MCForge or MCDawn and it doesn't work properly on MCDzienny, it may be from another software and it uses a method that MCDzienny no longer has or it never had.
It has something to do with the "GlobalSpawn" and when I find out this error, I wholeheartedly will tell you why it is not working, I will edit this comment when I find the solution to this problem.

EDIT: Yep, there's a method that comes from a different software and is in there.
-Lucas

No, because I got the same errors with GlobalMessage a while ago.
Warren1001
 
Posts: 197
Joined: 08 Aug 2012, 03:50

Re: /hide (rewritting to include welcome/farewell messages)

Postby HETAL » 04 Jun 2013, 01:28

If you do /cmdcreate hide it will put the coding of /hide into your source folder and you can edit the code from that
YOU HAVENT SEEN THE LAST OF ME ISMELLIKE
HETAL
 
Posts: 397
Joined: 24 May 2013, 12:10

Next

Return to Help in Coding

Who is online

Users browsing this forum: No registered users and 6 guests

cron