/upgrade - upgrades your rank if you know the password

/upgrade - upgrades your rank if you know the password

Postby jkl139 » 26 Jun 2011, 18:43

If you type /upgrade password, your level will upgrade :D

You can change the password in the Source text where it says ThisIsThePassword

Code: Select all
namespace MCLawl
{
    using System;
    public class CmdUpgrade : Command
    {
        public override void Help(Player p) { Player.SendMessage(p, "/upgrade <password> - Upgrades your rank. If you have the correct password, of course."); }
        public override void Use(Player p, string message)
        {
            if (p != null)
            {
                Player from = Player.Find(p.name);
                Group group = Group.Find("builder");
                if (group.Permission <= p.group.Permission)
                {
                    Player.SendMessage(p, "You cannot upgrade yourself any higher");
                    return;
                }
                else
                {
                    string password = "ThisIsThePassword";
                    if (message == password)
                    {
                        from.group.playerList.Remove(from.name);
                        from.group.playerList.Save();
                        group.playerList.Add(from.name);
                        group.playerList.Save();
                        Player.GlobalChat(from, string.Concat((string[])new string[] { from.color, from.name, Server.DefaultColor, " set his/her own rank to ", group.color, group.name, Server.DefaultColor, ". Isn't it amazing?" }), false);
                        from.group = group;
                        from.color = from.group.color;
                        Player.GlobalDie(from, false);
                        from.SendMessage(string.Concat((string[])new string[] { "You are now ranked ", group.color, group.name, Server.DefaultColor, ", type /help for your new set of commands." }));
                        Player.GlobalSpawn(from, from.pos[0], from.pos[1], from.pos[2], from.rot[0], from.rot[1], false, "");
                    }
                    else
                    {
                        if (message == "")
                        {
                            Player.SendMessage(p, "You must type a password");
                        }
                        else
                        {
                            Player.SendMessage(p, "Incorrect password.");
                        }
                    }
                }
            }
            else
            {
                Player.SendMessage(p, "The console is already awesome. You do not need to upgrade it.");
            }
        }
        public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
        public override bool museumUsable { get { return true; } }
        public override string name { get { return "upgrade"; } }
        public override string shortcut { get { return ""; } }
        public override string type { get { return "other"; } }
    }
}


NOTE: Only upgrades from guest to builder (good if you want people to read the rules, put the password in /rules :P)
Image
Image
User avatar
jkl139
 
Posts: 444
Joined: 13 Jun 2011, 11:46
Location: MCDzienny Forum

Re: /upgrade - upgrades your rank if you know the password

Postby asdfmovie2121 » 02 Dec 2013, 00:31

I might be late but the command got compile errors.
Owner of DeadIsland Survival[New]
asdfmovie2121
 
Posts: 26
Joined: 29 Dec 2012, 13:18

Re: /upgrade - upgrades your rank if you know the password

Postby _Retaliate_ » 04 Dec 2013, 06:52

It's because he made this command for or with MCLawl. Where it says, "namespace MCLawl" it should be "namepsace MCDzienny"
Also, the using statement is inside the namespace, where it says "Using System;", that should be at the very beginning of the code.
Image
_Retaliate_
 
Posts: 68
Joined: 26 Sep 2013, 11:16

Re: /upgrade - upgrades your rank if you know the password

Postby Leeizazombie » 04 Dec 2013, 20:27

Try this:
Code: Select all
using System;
namespace MCDzienny
{
   
    public class CmdUpgrade : Command
    {
        public override void Help(Player p) { Player.SendMessage(p, "/upgrade <password> - Upgrades your rank. If you have the correct password, of course."); }
        public override void Use(Player p, string message)
        {
            if (p != null)
            {
                Player from = Player.Find(p.name);
                Group group = Group.Find("builder");
                if (group.Permission <= p.group.Permission)
                {
                    Player.SendMessage(p, "You cannot upgrade yourself any higher");
                    return;
                }
                else
                {
                    string password = "ThisIsThePassword";
                    if (message == password)
                    {
                        from.group.playerList.Remove(from.name);
                        from.group.playerList.Save();
                        group.playerList.Add(from.name);
                        group.playerList.Save();
                        Player.GlobalChat(from, string.Concat((string[])new string[] { from.color, from.name, Server.DefaultColor, " set his/her own rank to ", group.color, group.name, Server.DefaultColor, ". Isn't it amazing?" }), false);
                        from.group = group;
                        from.color = from.group.color;
                        Player.GlobalDie(from, false);
                        from.SendMessage(string.Concat((string[])new string[] { "You are now ranked ", group.color, group.name, Server.DefaultColor, ", type /help for your new set of commands." }));
                        Player.GlobalSpawn(from, from.pos[0], from.pos[1], from.pos[2], from.rot[0], from.rot[1], false, "");
                    }
                    else
                    {
                        if (message == "")
                        {
                            Player.SendMessage(p, "You must type a password");
                        }
                        else
                        {
                            Player.SendMessage(p, "Incorrect password.");
                        }
                    }
                }
            }
            else
            {
                Player.SendMessage(p, "The console is already awesome. You do not need to upgrade it.");
            }
        }
        public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
        public override bool museumUsable { get { return true; } }
        public override string name { get { return "upgrade"; } }
        public override string shortcut { get { return ""; } }
        public override string type { get { return "other"; } }
    }
}

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 3 guests

cron