Hello, I am willing to take requests for people who want an Auto Ranking system command. I just need some information first and also to point out some notes.
Example: survivor : 10 ^ That means that when the player reaches level 10, he/she will be ranked to "survivor".
Notes: # If you have experience in coding, you can use the code I have at the end of the topic. # If you change the ranks in your server while having Auto Rank, it will not function properly, you must remove it then request another. # The command will have to be activated after every start up, so if you restart, you must use /autosystem enable again.
...while (active) { Thread.Sleep(10000); foreach (Player pl in Player.players) ... Player.SendMessage(p, "/autorank - Checks player stats every 10 secs to see if the can rankup."); } } }
Sidenote: In my opinion, the stats check should be much longer than 10 seconds(no offense to you Leeizazombie). To give an approximation, the time should be between 4 and 12 minutes. If you have a small server(10-15 players), your number should be closer to 4 minutes, and if your server is large(45-50 players), your number should be closer to 12 minutes.
Here are my recommendations on a chart to help people out:
But players will be disappointed to wait for their ranked, as I've already notice with 10 seconds I shall create a timer instead of using Thread.Sleep, those ms's will be handy to me, thanks. Maybe I can make it an optional setting to alter the refresh rate hmm?
Re: Request Auto-Rank System V2 (Zombie Survival)
Posted: 26 Mar 2014, 03:38
by Leeizazombie
I've added the Timer, it's now much reliable while refreshing every 5 seconds, this will guarantee no extreme usage of CPU.
Re: Request Auto-Rank System V2 (Zombie Survival)
Posted: 27 Mar 2014, 23:47
by HelloWorldCool
Leeizazombie wrote:I've added the Timer, it's now much reliable while refreshing every 5 seconds, this will guarantee no extreme usage of CPU.
Hmm...possibly better, because not many other commands use the timer feature yet. But still I don't recommend 5 seconds...make it 20 seconds least(4x per min = a lot of work ).
The timer's ms compared to the round's ms cannot exceed 25%...or bad things can happen!
Ex: Timer: 5000 ms - (5 sec) Round time: 20,000 ms - (20 sec)
Anyway, we'll need some people to test out your command.
Re: Request Auto-Rank System V2 (Zombie Survival)
Posted: 07 May 2014, 04:47
by asdfmovie2121
Lee can you make me a auto-rank system?? Heres my ranks and the levels I want them to be Potential:3 Aware:15 Survivor:30 ExpertedHuman:50 Leader:70
Re: Request Auto-Rank System V2 (Zombie Survival)
Posted: 07 May 2014, 06:14
by _Retaliate_
Lee, you should really make it read from a config file. It would be so much easier than having people request the new command each time. I know how to do this, but there's no fun in it if I just tell you how to do it. Hint: string.Split();
Re: Request Auto-Rank System V2 (Zombie Survival)
Posted: 07 May 2014, 18:13
by Leeizazombie
asdfmovie2121 wrote:Lee can you make me a auto-rank system?? Heres my ranks and the levels I want them to be Potential:3 Aware:15 Survivor:30 ExpertedHuman:50 Leader:70
using System; using System.IO; using System.Threading; using System.Timers;
namespace MCDzienny { public class Auto_System : Command { public override string name { get { return "autosystem"; } } public override string shortcut { get { return ""; } } public override string type { get { return "information"; } } public override bool museumUsable { get { return true; } } public override LevelPermission defaultRank { get { return LevelPermission.Admin; } } bool active = false; public override void Use(Player p, string message) { if (message == "enable") { if (active) { Player.SendMessage(p, "The system is already active!"); return; } Player.SendMessage(p, "Activated!"); active = true; var myTimer = new System.Timers.Timer(); myTimer.Elapsed += new ElapsedEventHandler(checkStats); myTimer.Interval = 5000; myTimer.Enabled = true; } } private void checkStats(object source, ElapsedEventArgs e) { Player.players.ForEachSync(pl => { if (pl.group.name == "guest") // Upgrading by Level 3 { if (pl.ZombieTier >= 3) { Command.all.Find("setrank").Use(null, pl.name + " potential Auto: You got to level 5!"); } } else if (pl.group.name == "potential") // Upgrading by Level 15 { if (pl.ZombieTier >= 15) { Command.all.Find("setrank").Use(null, pl.name + " aware Auto: You got to level 10!"); } } else if (pl.group.name == "aware") // Upgrading by Level 30 { if (pl.ZombieTier >= 30) { Command.all.Find("setrank").Use(null, pl.name + " survivor Auto: You got to level 20!"); } } else if (pl.group.name == "survivor") // Upgrading by Level 50 { if (pl.ZombieTier >= 50) { Command.all.Find("setrank").Use(null, pl.name + " expertedHuman Auto: You got to level 30!"); } } else if (pl.group.name == "expertedHuman") // Upgrading by Level 70 { if (pl.ZombieTier >= 70) { Command.all.Find("setrank").Use(null, pl.name + " leader Auto: You got to level 40!"); } }
}); } public override void Help(Player p) { Player.SendMessage(p, "/autosystem enable - Checks player stats every 5 seconds."); } } }
One problem, I can't tell what the players start level is on your server, you never mentioned. Like what rank they are as level 1. I assumed it was "guest", if it isn't please let me know or look in the code and change it!
Enjoy!
Re: Request Auto-Rank System V2 (Zombie Survival)
Posted: 12 May 2014, 22:08
by asdfmovie2121
These are all the ranks Citizen:Guest Potential:3 Aware:15 Survivor:30 ExpertedHuman:50 Leader:70 Moderator Operator Superop King