WARNING: There's a fault with this version, and if anyone can help I would be much appreciated!
Fault: if add a player called "cheese" for example, any player called "c" or "che" or "chees" ect.. will be kicked however the likes of "cheeset" or "chet" ect.. would be safe.
Coders: I have unfinished work that I'm having problems with and you can finish if you want, they are inside the /* */.
I hope y'all like it!
- Code: Select all
using System;
using System.IO;
namespace MCDzienny
{
public class CmdAkick : Command
{
public override string name { get { return "autokick"; } }
public override string shortcut { get { return "akick"; } }
public override string type { get { return "mod"; } }
public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
public override void Init()
{
Player.Joined += (object sender, PlayerEventArgs e) =>
{
string list = File.ReadAllText("autokick.txt");
if (list.Contains(e.Player.name))
{
e.Player.Kick("Auto-Kick: You've been added to an AutoKick system.");
}
};
}
public override void Use(Player p, string message)
{
string third = message.Split(' ')[1];
string second = message.Split(' ')[0];
if (message == " ")
{
Help(p);
return;
}
if (second == "add")
{
if (third == "")
{
Player.SendMessage(p, third + "Please Specify a players name!");
}
if (!File.Exists("autokick.txt"))
{
File.Create("autokick.txt");
}
File.AppendAllText("autokick.txt", third + ", ");
Player.SendMessage(p, "%f" + third + " %eis now in the Auto Kick List!");
}
/* if (second == "list")
{
Player.SendMessage(p, "%cAuto Kick List%f: ");
foreach (string list in File.ReadAllLines("autokick.txt"))
{
Player.SendMessage(p, list);
}
}*/
/* if (second == "remove")
{
if (third == "")
{
}
}*/
}
public override void Help(Player p)
{
Player.SendMessage(p, "/autokick add [player] - Auto kicks players you've added becuase they ban evade.");
}
}
}