/disconnect (Does not add to kicked times)

/disconnect (Does not add to kicked times)

Postby Leeizazombie » 22 Dec 2013, 04:19

For those who want a disconnection command that does not apply to your times kicked log, then here it is.
This may be handy for some coders!

Code: Select all
using System;
using System.IO;
using System.Net;
namespace MCDzienny
{
    public class CmdDisconnect : Command
    {
        public override string name { get { return "disconnect"; } }
        public override string shortcut { get { return "disc"; } }
        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)
        {
            p.Disconnect();
        }

        public override void Help(Player p)
        {
            Player.SendMessage(p, "/disconnect -- Leave the server.");
        }
    }
}
Owner of:
LeeIzaZombie Freebuild and Lava Survival V2 (Shut Down and updated)
LeeIzaZombie Survival (Comming back soon)

Contact:
Skype: leeizazombie
IRC: irc.geekshed.net, #leeizazombie, #mcclassichosting
User avatar
Leeizazombie
 
Posts: 536
Joined: 10 Jun 2013, 17:45
Location: Ireland.

Re: /disconnect (Does not add to kicked times)

Postby joppiesaus » 22 Dec 2013, 11:12

Here! I've a improved version! It now accepts to kick players!
Syntax: /disconnect [player]

Also, you don't need that usings, the System using is even unneeded in this case!
Code: Select all
using System;

namespace MCDzienny
{
    public class CmdDisconnect : Command
    {
        public override string name { get { return "disconnect"; } }
        public override string shortcut { get { return "disc"; } }
        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)
        {
            string msg = message.Trim().Split(' ')[0];
           
            if (msg != null && msg != "")
            {
                 Player target = Player.Find(msg.ToLower());
                 if (target.hidden || target == null)
                 {
                     p.SendMessage("Player \"" + msg + "\" not found.";
                     return;
                 }

                 if (p.group.Permission < target.group.Permission)
                 {
                      p.SendMessage(who + " has a greater rank than you!");
                      return;
                 }
                 target.Disconnect();
                 return;
            }
           
            p.Disconnect();
        }

        public override void Help(Player p)
        {
            Player.SendMessage(p, "/disconnect -- Leave the server / make someone leave the server without adding to the \"kicked times\" count.");
        }
    }
}
joppiesaus
 
Posts: 379
Joined: 20 Aug 2012, 07:28
Location: in a obsedian house, with glass in it so i can see the lava!

Re: /disconnect [player]

Postby lordmaker1234 » 23 Dec 2013, 22:21

It Gave Me Compilation Errors :/

:?
lordmaker1234
 
Posts: 9
Joined: 15 Dec 2013, 18:25

Re: /disconnect (Does not add to kicked times)

Postby ismellike » 23 Dec 2013, 22:26

lordmaker1234 wrote:It Gave Me Compilation Errors :/

:?

Remember, every time you have errors, give us the errors.
What a beast...
User avatar
ismellike
Coder
 
Posts: 731
Joined: 31 Oct 2012, 04:04
Location: Kansas

Re: /disconnect (Does not add to kicked times)

Postby lordmaker1234 » 24 Dec 2013, 14:33

ismellike wrote:
lordmaker1234 wrote:It Gave Me Compilation Errors :/

:?

Remember, every time you have errors, give us the errors.


Thats the thing, it didnt tell me just said

Compilation error
Null
lordmaker1234
 
Posts: 9
Joined: 15 Dec 2013, 18:25

Re: /disconnect (Does not add to kicked times)

Postby Leeizazombie » 24 Dec 2013, 17:15

You will find the errors here in your server's folder:
Code: Select all
logs\compiler\errors.txt
Owner of:
LeeIzaZombie Freebuild and Lava Survival V2 (Shut Down and updated)
LeeIzaZombie Survival (Comming back soon)

Contact:
Skype: leeizazombie
IRC: irc.geekshed.net, #leeizazombie, #mcclassichosting
User avatar
Leeizazombie
 
Posts: 536
Joined: 10 Jun 2013, 17:45
Location: Ireland.


Return to Custom Commands

Who is online

Users browsing this forum: No registered users and 5 guests

cron