Is there a auto rank system in this software?

Is there a auto rank system in this software?

Postby cartose777 » 24 Mar 2013, 22:55

As the title says, Is there a auto rank system in this software? For example, if a player builds for a set amount of time or blocks placed is there a auto ranker that ranks the player? Please help! Thanks.
cartose777
 
Posts: 8
Joined: 16 Feb 2013, 19:28

Re: Is there a auto rank system in this software?

Postby ismellike » 24 Mar 2013, 23:07

No, but it could be made pretty easily, did you just want rank for blocks placed or in combination with things?
What a beast...
User avatar
ismellike
Coder
 
Posts: 731
Joined: 31 Oct 2012, 04:04
Location: Kansas

Re: Is there a auto rank system in this software?

Postby cartose777 » 25 Mar 2013, 00:58

Just blocks please.
cartose777
 
Posts: 8
Joined: 16 Feb 2013, 19:28

Re: Is there a auto rank system in this software?

Postby ismellike » 25 Mar 2013, 01:33

If I have any time this week I will make one for you, or you can ask conor ;p.
What a beast...
User avatar
ismellike
Coder
 
Posts: 731
Joined: 31 Oct 2012, 04:04
Location: Kansas

Re: Is there a auto rank system in this software?

Postby cartose777 » 25 Mar 2013, 19:46

lol okay, thanks so much.
cartose777
 
Posts: 8
Joined: 16 Feb 2013, 19:28

Re: Is there a auto rank system in this software?

Postby ismellike » 26 Mar 2013, 04:39

Ok so I made the autorank, but you need 1 thing, a command block.

Just open your [main_map's_name].cfg file in levels folder and put this.

<MapSettings>
<CommandBlocks>
<CommandBlock x="x" y="y" z="z" block="air" onChange="DoNothing">
<Command trigger="Walk" cooldown = "50">autorank</Command>
</CommandBlock>
</CommandBlocks>
</MapSettings>

Make sure to change the red to the position of your main spawn!

Here is the command

Code: Select all
using System;
using System.Threading;
using System.Collections.Generic;

namespace MCDzienny
{
    public class CmdAutorank : Command
    {
        public string firstRank=null;//change this, null, to your first rank and so on.
        public string secondRank=null;
       public string thirdRank=null;
         public string fourthRank=null;
         public string fithRank=null;
         public string sixthRank = null;
         public string seventhRank = null;
         public string eighthRank = null;  //to right here ^change those ranks to your ranks, add or remove as suits you.
        public long change;
        private static List<Player> tracking = new List<Player>();
        public override string name { get { return "autorank"; } }
        public override string shortcut { get { return ""; } }
        public override string type { get { return "mod"; } }
        public override bool museumUsable { get { return true; } }
        public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }

        public CmdAutorank() { }
        public override void Use(Player p, string message)
        {
            if (!tracking.Contains(p))
            {
                change = p.overallBlocks;
                tracking.Add(p);
                Thread buildThread = new Thread(new ThreadStart(delegate
                {
                    while (p.disconnected != true)
                    {
                        try
                        {
                            if (p.overallBlocks == 500 && p.group == Group.Find(firstRank))   //<--- You can replace the numbers to how many blocks placed you want for a levelup
                            {
                                //firstrank
                                Command.all.Find("promote").Use(null, p.name);  //dont replace null here.
                            }
                            if (p.overallBlocks == 1000 && p.group == Group.Find(secondRank))
                            {
                                //secondrank
                                Command.all.Find("promote").Use(null, p.name);
                            }
                            if (p.overallBlocks == 3000 && p.group == Group.Find(thirdRank))
                            {
                                //thirdrank
                                Command.all.Find("promote").Use(null, p.name);
                            }
                            if (p.overallBlocks == 5000 && p.group == Group.Find(fourthRank))
                            {
                                //fourthrank
                                Command.all.Find("promote").Use(null, p.name);
                            }
                            if (p.overallBlocks == 7000 && p.group == Group.Find(fithRank))
                            {
                                //fithrank
                                Command.all.Find("promote").Use(null, p.name);
                            }
                            if (p.overallBlocks == 10000 && p.group == Group.Find(sixthRank))
                            {
                                //sixthrank
                                Command.all.Find("promote").Use(null, p.name);
                            }
                            if (p.overallBlocks == 15000 && p.group == Group.Find(seventhRank))
                            {
                                //seventhrank
                                Command.all.Find("promote").Use(null, p.name);
                            }
                            if (p.overallBlocks == 18000 && p.group == Group.Find(eighthRank))
                            {
                                //eightrank
                                Command.all.Find("promote").Use(null, p.name);     //again add or remove the if(~~~~){  } to how many ranks you have.
                            }
                            if (p.group.Permission >= LevelPermission.Operator)
                            {                                                       //what this says is that nothing will happen with ops, you can change it if you want to, to follow^^
                                return;
                            }
                        }
                        catch
                        {
                            Player.GlobalMessage("There is an error in autorank");    //this will only pop up if you did not put all of your ranks under op.
                            return;
                        }
                    }
                }));
                buildThread.Start();
            }
            else
            {
                return;
            }
        }
        public override void Help(Player p)
        {
        }
    }
}


Make sure to edit it with notepad or something.

You have to change, towards the beginning, the firstRank/secondrank/thirdrank names from null to the name they are on your server.

If you dont have that many ranks just add or remove.

Also go below and look through the if( ) stuff and make sure that p.overallBlocks== #numberhere is the amount of blocks you want it to rank someone up on when they build.

Any questions just ask me, if it doesnt work just tell me cause I havent tested yet.
What a beast...
User avatar
ismellike
Coder
 
Posts: 731
Joined: 31 Oct 2012, 04:04
Location: Kansas

Re: Is there a auto rank system in this software?

Postby ismellike » 27 Mar 2013, 02:04

Code: Select all
using System;
using System.Threading;
using System.Collections.Generic;

namespace MCDzienny
{
    public class CmdAutorank : Command
    {
        public string firstRank="ember";//change this, null, to your first rank and so on.
        public string secondRank="shocker";
       public string thirdRank="fire";
         public string fourthRank="advfire";
         public string fithRank="ultrafire";
         public string sixthRank = "megafire";
         public string seventhRank = "uberfire";
         public string eighthRank = "gigafire";//to right here ^change those ranks to your ranks, add or remove as suits you.
        private static List<Player> tracking = new List<Player>();
        public override string name { get { return "autorank"; } }
        public override string shortcut { get { return ""; } }
        public override string type { get { return "mod"; } }
        public override bool museumUsable { get { return true; } }
        public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }

        public CmdAutorank() { }
        public override void Use(Player p, string message)
        {
            if (!tracking.Contains(p) && p.level.name.ToLower() == "guest_fb2")  //replace guest_fb2 with the name of your freebuild map, or if you want global rank just remove all of guest_fb2 part.
            {
                long change = p.overallBlocks;
                Player.SendMessage(p, "Build for autorank!");
                tracking.Add(p);
                Thread buildThread = new Thread(new ThreadStart(delegate
                {
                    while (p.disconnected != true)
                    {
                        if (p.level.name.ToLower() != "guest_fb2" || p.group.Permission>=Group.Find(eighthRank).Permission)
                        {
                            change = p.overallBlocks-change;
                            Player.SendMessage(p, "Building ended, you made a block difference of " + change.ToString());
                            tracking.Remove(p);
                            return;
                        }
                        try
                        {
                            change = p.overallBlocks - change;
                            if (change == 100 && p.group == Group.Find(firstRank))   //<--- You can replace the numbers to how many blocks placed you want for a levelup
                            {
                                //firstrank
                                Command.all.Find("promote").Use(null, p.name); change = p.overallBlocks;
                                Command.all.Find("review").Use(p, "ask");
                                //dont replace null here.
                            }
                            if (change == 250 && p.group == Group.Find(secondRank))
                            {
                                //secondrank
                                Command.all.Find("review").Use(p, "ask");
                                Command.all.Find("promote").Use(null, p.name); change = p.overallBlocks;
                            }
                            if (change == 500 && p.group == Group.Find(thirdRank))
                            {
                                //thirdrank
                                Command.all.Find("review").Use(p, "ask");
                                Command.all.Find("promote").Use(null, p.name); change = p.overallBlocks;
                            }
                            if (change == 1000 && p.group == Group.Find(fourthRank))
                            {
                                //fourthrank
                                Command.all.Find("review").Use(p, "ask");
                                Command.all.Find("promote").Use(null, p.name); change = p.overallBlocks;
                            }
                            if (change == 1250 && p.group == Group.Find(fithRank))
                            {
                                //fithrank
                                Command.all.Find("review").Use(p, "ask");
                                Command.all.Find("promote").Use(null, p.name); change = p.overallBlocks;
                            }
                            if (change == 1500 && p.group == Group.Find(sixthRank))
                            {
                                //sixthrank
                                Command.all.Find("review").Use(p, "ask");
                                Command.all.Find("promote").Use(null, p.name); change = p.overallBlocks;
                            }
                            if (change == 1750 && p.group == Group.Find(seventhRank))
                            {
                                //seventhrank
                                Command.all.Find("review").Use(p, "ask");
                                Command.all.Find("promote").Use(null, p.name); change = p.overallBlocks;
                            }
                            if (change == 2000 && p.group == Group.Find(eighthRank))
                            {
                                //eightrank
                                Command.all.Find("review").Use(p, "ask");
                                Command.all.Find("promote").Use(null, p.name); change = p.overallBlocks;     //again add or remove the if(~~~~){  } to how many ranks you have.
                            }
                        }
                        catch
                        {
                            Player.GlobalMessage("There is an error in autorank");    //this will only pop up if you did not put all of your ranks under op.
                            return;
                        }
                    }
                }));
                buildThread.Start();
            }
            else
            {
                return;
            }
        }
        public override void Help(Player p)
        {
        }
    }
}


Use this code, I tested it already and other one had some errors.
Needs a little editing to match your server though just look for anything that has // beside it.
What a beast...
User avatar
ismellike
Coder
 
Posts: 731
Joined: 31 Oct 2012, 04:04
Location: Kansas


Return to Help

Who is online

Users browsing this forum: No registered users and 8 guests

cron