With this command you will be able to see the top ten most active players of the server.
It will filter out the people that are glitched too that have like 174283 hours in.
- Code: Select all
using System.Data;
using System;
namespace MCDzienny
{
public class CmdToptime : Command
{
public override string name
{
get
{
return "toptime";
}
}
public override string shortcut
{
get
{
return "";
}
}
public override string type
{
get
{
return "other";
}
}
public override bool museumUsable
{
get
{
return true;
}
}
public override LevelPermission defaultRank
{
get
{
return LevelPermission.Banned;
}
}
public CmdToptime()
{
}
public override void Use(Player p, string message)
{
int count=0;
Player.SendMessage(p, "The most active of the server:");
using (DataTable dataTable = DBInterface.fillData("SELECT * FROM `Players` ORDER BY TotalMinutesPlayed DESC LIMIT 20"))
{
for (int index = 0; index < dataTable.Rows.Count; ++index)
{
int time = Convert.ToInt32(dataTable.Rows[index]["TotalMinutesPlayed"]) / 60;
if (count == 10)
{
break;
}
if (time>10000)
{
continue;
}
else
{
count += 1;
Player.SendMessage(p, string.Format("%c{0}.%e {1} - time: {2} hours", (object)(count.ToString()), (object)dataTable.Rows[index]["Name"].ToString(), (object)(time.ToString())));
}
}
}
}
public override void Help(Player p)
{
Player.SendMessage(p, "/toptime - Displays names of ten most active players.");
}
}
}