/legal

Re: /legal

Postby leicestercity » 09 Mar 2014, 19:14

here we go
Code: Select all
// Created by leicestercity

using System;
using System.IO;
using System.Threading;
     
namespace MCDzienny
{
    public class legal : Command
    {
        public override string name { get { return "legal"; } }
        public override string shortcut { get { return "legal"; } }
        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.GlobalMessage("%4last are legal good luck %2:D");
        }

        public override void Help(Player p)
        {
            Player.SendMessage(p, "gives a message out that the last alive are legal ");
        }
    }
}
LEICESTER TILL I DIE
leicestercity
 
Posts: 33
Joined: 08 Mar 2014, 16:36

Re: /legal

Postby Kill_Bot_UkzZz » 09 Mar 2014, 19:20

Full command now works in ALL MCDzienny servers, even over console :D

Spoiler:
Kill_Bot_UkzZz
 
Posts: 13
Joined: 18 Feb 2014, 13:35

Re: /legal

Postby leicestercity » 10 Mar 2014, 17:26

so i messed around with the code and i think ive got an update :D

Code: Select all
// Created by leicestercity

using System;
using System.IO;
using System.Threading;
     
namespace MCDzienny
{
    public class legal : Command
    {
        public override string name { get { return "legal"; } }
        public override string shortcut { get { return "legal"; } }
        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.GlobalMessage("Last are legal check done by +p.color +p.name");
        }

        public override void Help(Player p)
        {
            Player.SendMessage(p, "gives a message out that the last alive are legal ");
        }
    }
LEICESTER TILL I DIE
leicestercity
 
Posts: 33
Joined: 08 Mar 2014, 16:36

Re: /legal

Postby HETAL » 10 Mar 2014, 19:47

You can't use p.name inside " " or else it would appear as "p.name" on the server
Code: Select all
// Created by leicestercity

using System;
using System.IO;
using System.Threading;
     
namespace MCDzienny
{
    public class CmdLegal : Command
    {
        public override string name { get { return "legal"; } }
        public override string shortcut { get { return "legal"; } }
        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.GlobalMessage("Last are legal check done by " + p.color + p.name);
        }

        public override void Help(Player p)
        {
            Player.SendMessage(p, "gives a message out that the last alive are legal ");
        }
    }
Do note that +p.name will not work, it has to be "+ p.name" also it is not needed, but it would be wise if it was "public class CmdLegal : Command" instead of "public class legal : Command" also since you did the same thing for the shortcut as you did for the name, I would leave the shortcut as "" to show that there is no shortcut
YOU HAVENT SEEN THE LAST OF ME ISMELLIKE
HETAL
 
Posts: 397
Joined: 24 May 2013, 12:10

Re: /legal

Postby leicestercity » 06 Apr 2014, 15:25

Heres the update sorry it took so long tell meh if it works :P.

Code: Select all
// Created by leicestercity

using System;
using System.IO;
using System.Threading;
     
namespace MCDzienny
{
    public class legal : Command
    {
        public override string name { get { return "legal"; } }
        public override string shortcut { get { return "legal"; } }
        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.GlobalMessage("%4last are legal good luck %2:D Check Done By" p.color + p.PublicName);
        }

        public override void Help(Player p)
        {
            Player.SendMessage(p, "gives a message out that the last alive are legal ");
        }
    }
LEICESTER TILL I DIE
leicestercity
 
Posts: 33
Joined: 08 Mar 2014, 16:36

Re: /legal

Postby dzienny » 06 Apr 2014, 17:18

It's still wrong. You should learn the very basics of programming in C# first. To do it:
1. Download Microsoft Visual Studio C# Express (free) http://www.visualstudio.com/en-us/produ ... ss-vs.aspx Select a version that is compatible with your Windows. If you have an old version of Windows then download Visual C# 2010 Express.
2. Now you can write your first program with this guide: http://msdn.microsoft.com/en-us/library/k1sx6ed2.aspx
3. If you manage to run your first "Hello World' program, then you should check Google for more C# tutorials that will help you understand programming better.
4. Then you should read some books about programming.
5. Read more :)

Somewhere between the point 3 and 5 you will be already able to write a working Custom Command.
User avatar
dzienny
Administrator
 
Posts: 1181
Joined: 23 Jan 2011, 14:27

Previous

Return to Custom Commands

Who is online

Users browsing this forum: No registered users and 4 guests

cron