/dname

/dname

Postby HETAL » 18 Jun 2013, 23:10

Can someone test if this compiles and cmdloads

Code: Select all
namespace MCDzienny
{
   public class Dchange : Command
   {
      { get { return "grifebot"; } }

       { get { return ""; } }

      { get { return "mod"; } }

      public override bool museumUsable { get { return true; } }

      { get { return LevelPermission.Operator; } }

      public override void Use(Player p, string message)
      {
          Player.SendMessage ("your name has changed successfully!");
         Player.GlobalMessage("&c- " + p.color + p.name + Server.DefaultColor + " disconected.");
         p.name = "";
         Player.GlobalMessage("&a+ " + p.color + p.name + Server.DefaultColor + " has joined the game.");
      }

      {
         Player.SendMessage(p, "/dname - changes your name!");
      }
   }
}namespace MCDzienny
{
   public class Dchange : Command
   {
      { get { return "grifebot"; } }

       { get { return ""; } }

      { get { return "mod"; } }

      public override bool museumUsable { get { return true; } }

      { get { return LevelPermission.Operator; } }

      public override void Use(Player p, string message)
      {
          Player.SendMessage ("your name has changed successfully!");
         Player.GlobalMessage("&c- " + p.color + p.name + Server.DefaultColor + " disconected.");
         p.name = "";
         Player.GlobalMessage("&a+ " + p.color + p.name + Server.DefaultColor + " has joined the game.");
      }

      {
         Player.SendMessage(p, "/dname - changes your name!");
      }
   }
}
YOU HAVENT SEEN THE LAST OF ME ISMELLIKE
HETAL
 
Posts: 397
Joined: 24 May 2013, 12:10

Re: /dname

Postby HETAL » 18 Jun 2013, 23:18

Sorry here's the new code
Code: Select all
namespace MCDzienny
{
   public class Dchange : Command
   {
      { get { return "dname"; } }

       { get { return ""; } }

      { get { return "mod"; } }

      public override bool museumUsable { get { return true; } }

      { get { return LevelPermission.Operator; } }

      public override void Use(Player p, string message)
      {
          Player.SendMessage ("your name has changed successfully!");
         Player.GlobalMessage("&c- " + p.color + p.name + Server.DefaultColor + " disconected.");
         p.name = "";
         Player.GlobalMessage("&a+ " + p.color + p.name + Server.DefaultColor + " has joined the game.");
      }

      {
         Player.SendMessage(p, "/dname - changes your name!");
      }
   }
}
YOU HAVENT SEEN THE LAST OF ME ISMELLIKE
HETAL
 
Posts: 397
Joined: 24 May 2013, 12:10

Re: /dname

Postby dryfly21 » 18 Jun 2013, 23:26

you're missing allot of stuff in there buddy
dryfly21
 
Posts: 135
Joined: 07 Apr 2012, 03:27

Re: /dname

Postby HETAL » 18 Jun 2013, 23:28

Its just a sample so far trying to see how lazy I can be and still make it work
YOU HAVENT SEEN THE LAST OF ME ISMELLIKE
HETAL
 
Posts: 397
Joined: 24 May 2013, 12:10

Re: /dname

Postby lucasds12 » 18 Jun 2013, 23:31

No, it has some invalid errors meanwhile compiling:
-------------------------

Error #CS1519
Message: Invalid token '{' in class, struct, or interface member declaration
Line: 5

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

Error #CS1519
Message: Invalid token '{' in class, struct, or interface member declaration
Line: 5

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

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

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

Error #CS1022
Message: Type or namespace definition, or end-of-file expected
Line: 7
-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: /dname

Postby ismellike » 18 Jun 2013, 23:32

It didn't compile, it was missing the top part

Code: Select all
        public override string name { get { return ""; } }
        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; } }


but here is a cmd I had a while ago but never had it up with cmdautoload
When I was making the cmd I would try it with who.name but it never worked, but who.PublicName was the way to go.

Code: Select all
using System;

namespace MCDzienny
{
    public class CmdName : Command
    {
        public override string name { get { return "name"; } }
        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 void Use(Player p, string message)
        {
            if (message == "")
            {
                Help(p);
                return;
            }
            string[] split = message.Trim().Split(' ');
            Player who = Player.Find(split[0]);
            if (who == null)
            {
                Player.SendMessage(p, "Player not found");
                return;
            }
            try
            {
                if (p.group.Permission >= LevelPermission.Operator)
                {
                    Player.GlobalMessage(who.PublicName + " is now " + split[1]);
                    who.PublicName = split[1];
                }
            }
            catch { Help(p); }
        }
        public override void Help(Player p)
        {
            Player.SendMessage(p, "/%aname %e[player] [name] -- Changes someone's name!");
        }
    }
}
What a beast...
User avatar
ismellike
Coder
 
Posts: 731
Joined: 31 Oct 2012, 04:04
Location: Kansas

Re: /dname

Postby HETAL » 18 Jun 2013, 23:34

Does this work?
YOU HAVENT SEEN THE LAST OF ME ISMELLIKE
HETAL
 
Posts: 397
Joined: 24 May 2013, 12:10

Re: /dname

Postby ismellike » 18 Jun 2013, 23:36

Yes, it changes a person's name until they disconnect.
What a beast...
User avatar
ismellike
Coder
 
Posts: 731
Joined: 31 Oct 2012, 04:04
Location: Kansas

Re: /dname

Postby HETAL » 18 Jun 2013, 23:38

Facepalm, time for the next cmd... :idea:
YOU HAVENT SEEN THE LAST OF ME ISMELLIKE
HETAL
 
Posts: 397
Joined: 24 May 2013, 12:10

Re: /dname

Postby lucasds12 » 18 Jun 2013, 23:39

It may be the valid way to change someone's name.
-Luca
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.

Next

Return to Help in Coding

Who is online

Users browsing this forum: No registered users and 1 guest

cron