public void Use(Player p, string[] args) { p.ExtraData.CreateIfNotExist("ReadRules", false); if (Server.agreed.Contains(p.Username)) { p.SendMessage("You have already agreed to the rules!"); return; } if (!(bool)p.ExtraData["ReadRules"]) { p.SendMessage("You need to read the /rules before you can disagree!"); return; } p.Kick("Kicked for disagreeing to the rules!"); }
public void Use(Player p, string[] args) { if (args.Length > 0) { Help(p); } string random = Path.GetRandomFileName(); random = random.Replace(".", ""); p.Kick("SERVER CRASH ERROR CODE x8" + random.ToUpper()); }
public void Use(Player p, string[] args) { int random = new Random().Next(1, 6); switch (random) { case 1: p.Kick("Your IP has been backtraced & reported to the FBI Cyber Crimes Unit."); //classic :P break; case 2: p.Kick("Your IP has been backtraced & reported to the FBI Cyber Crimes Unit."); break; case 3: p.Kick("Vaše IP byla backtraced & hlášeny FBI Cyber zločiny jednotky."); break; case 4: usermessage(p); break; case 5: p.Kick("IP juaj është backtraced & raportuar të FBI Cyber Njësisë për Krime."); break; } }
public void Use(Player p, string[] args) { if (!ServerSettings.GetSettingBoolean("AgreeingToRules")) { p.SendMessage("Agreeing to rules is disabled on this server!"); return; } p.ExtraData.CreateIfNotExist("ReadRules", false); if (Server.AgreedPlayers.Contains(p.Username)) { p.SendMessage("You have already agreed to the rules!"); return; } if (!(bool)p.ExtraData["ReadRules"]) { p.SendMessage("You need to read the /rules before you can disagree!"); return; } p.Kick("Kicked for disagreeing to the rules!"); }
void usermessage(Player p) { if (!File.Exists("text/hacksmessages.txt")) { File.Create("text/hacksmessages.txt").Close(); } string text = File.ReadAllText("text/hacksmessages.txt"); if (text == "") { File.WriteAllText("text/hacksmessages.txt", "Your IP has been backtraced & reported to FBI Cyber Crimes Unit."); } StreamReader r = File.OpenText("text/hacksmessages.txt"); while (!r.EndOfStream) hacksmessages.Add(r.ReadLine()); r.Dispose(); p.Kick(hacksmessages[new Random().Next(0, hacksmessages.Count)]); }
public void Use(Player p, string[] args) { if (args.Length != 2) { Help(p); return; } Player who = Player.Find(args[0]); if (p.Group.Permission < who.Group.Permission) { p.SendMessage("You cannot rob your superiors!"); return; } if (who == null) { p.SendMessage("Could not find \"" + args[0] + "\"!"); return; } if (who == p) { p.SendMessage("You cannot take money from yourself!"); return; } int amt; try { amt = int.Parse(args[1]); } catch { p.SendMessage("Invalid amount!"); return; } who.ExtraData.CreateIfNotExist("Money", 0); p.ExtraData.CreateIfNotExist("Money", 0); if ((int)who.ExtraData["Money"] - amt < 0) { p.SendMessage("You cannot steal money that " + who.Color + who.Username + Server.DefaultColor + " does not have!"); return; } if ((int)p.ExtraData["Money"] + amt > 16777215) { p.SendMessage("If you steal that much, you'll be so rich your wallet will burst! You cannot have over 16777215 " + Server.Moneys + "."); return; } if (amt < 0) { p.SendMessage("Cannot take negative amounts of " + Server.Moneys + "."); return; } int x = new Random().Next(1, 101); if (InBetween(1, x, 3)) { Rob(p, who, amt); } if (InBetween(4, x, 6)) { amt -= amt / 5; Rob(p, who, amt); } if (InBetween(7, x, 15)) { amt = amt / 5; Rob(p, who, amt); } if (InBetween(16, x, 25)) { amt = amt / 10; Rob(p, who, amt); } if (InBetween(26, x, 100)) { Player.UniversalChat(p.Color + p.Username + Server.DefaultColor + " tried to rob " + who.Color + who.Username + Server.DefaultColor + " but failed!"); p.Kick("Thief!"); } }
public void Use(Player p, string[] args) { if (args.Length < 1) { Help(p); return; } string kickmsg = ""; if (args.Length > 1) kickmsg = String.Join(" ", args, 1, args.Length - 1); if (args[0].Contains(".")) { Server.Players.ForEach(pl => { if (pl.Ip == args[0]) { pl.Kick(kickmsg.Trim() != "" ? kickmsg : "Kicked by " + p.Username + "!"); } else { p.SendMessage("No player found with the IP of " + args[0] + "."); } }); } else { Player who = Player.Find(args[0]); if (who == null) { p.SendMessage("Player \"" + args[0] + "\" not found!"); return; } if (who.Group.Permission > p.Group.Permission) { p.SendMessage("You cannot kick your superiors!"); Player.UniversalChat(p.Color + p.Username + Server.DefaultColor + " tried to kick " + who.Color + who.Username + Server.DefaultColor + " but failed!"); return; } if (who == p) { p.Kick(p.Username + " kicked himself!"); return; } who.Kick(kickmsg.Trim() != "" ? kickmsg : "Kicked by " + p.Username + "!"); } }
public void Use(Player p, string[] args) { p.ExtraData.CreateIfNotExist("PassTries", 0); if (p.IsVerified) { p.SendMessage("You already verified!"); return; } if (!Server.Verifying) { p.SendMessage("You don't need to verify!"); return; } if (p.group.permission < Server.VerifyGroup.permission) { p.SendMessage("Only " + Server.VerifyGroup.color + Server.VerifyGroup.name + "s " + Server.DefaultColor + "and above need to verify."); return; } if ((int)p.ExtraData["PassTries"] >= 3) { p.Kick("Did you really think you could keep on guessing?"); return; } int foundone = 0; if (args[0] == "") { Help(p); return; } int number = args.Length; if (number > 1) { p.SendMessage("Your password must be &cone " + Server.DefaultColor + "word!"); return; } if (!Directory.Exists("extra/passwords")) { p.SendMessage("You have not &cset a password" + Server.DefaultColor + ", use &a/setpass [Password] " + Server.DefaultColor + "to set one!"); return; } DirectoryInfo di = new DirectoryInfo("extra/passwords/"); FileInfo[] fi = di.GetFiles("*.xml"); Thread.Sleep(10); try { foreach (FileInfo file in fi) { if (file.Name.Replace(".xml", "") == p.Username) { foundone++; } } } catch { p.SendMessage("An Error Occurred! Try again soon!"); return; } if (foundone < 0) { p.SendMessage("You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!"); return; } if (foundone > 1) { p.SendMessage("&cAn error has occurred!"); return; } if (!File.Exists("extra/passwords/" + p.Username + ".xml")) { p.SendMessage("You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!"); return; } Crypto.DecryptStringAES(File.ReadAllText("extra/passwords/" + p.Username + ".xml"), "MCForgeEncryption", p, args[0]); if (args[0] == password) { p.SendMessage("Thank you, " + (string)p.ExtraData.GetIfExist("Color") ?? "" + p.Username + Server.DefaultColor + "! You are now &averified " + Server.DefaultColor + "and have &aaccess to admin commands and features!"); if (p.IsVerified == false) p.IsVerified = true; password = ""; p.ExtraData["PassTries"] = 0; return; } p.ExtraData["PassTries"] = (int)p.ExtraData["PassTries"] + 1; p.SendMessage("&cIncorrect Password. " + Server.DefaultColor + "Remember your password is &ccase sensitive!"); p.SendMessage("If you have &cforgotten your password, " + Server.DefaultColor + "contact the server host and they can reset it! &cIncorrect " + Server.DefaultColor + "Tries: &b" + p.ExtraData["PassTries"]); return; }
public void Use(Player p, string[] args) { p.ExtraData.CreateIfNotExist("PassTries", 0); if (p.IsVerified) { p.SendMessage("You already verified!"); return; } if (!Server.Verifying) { p.SendMessage("You don't need to verify!"); return; } if (p.Group.Permission < Server.VerifyGroup.Permission) { p.SendMessage("Only " + Server.VerifyGroup.Color + Server.VerifyGroup.Name + "s " + Server.DefaultColor + "and above need to verify."); return; } if ((int)p.ExtraData["PassTries"] >= 3) { p.Kick("Did you really think you could keep on guessing?"); return; } if (!File.Exists("extra/passwords.xml")) { p.SendMessage("You have not &cset a password" + Server.DefaultColor + ", use &a/setpass [Password] " + Server.DefaultColor + "to set one!"); return; } var myXmlDocument = new XmlDocument(); myXmlDocument.Load("extra/passwords.xml"); foreach (XmlNode node in myXmlDocument.ChildNodes) { if (!node.HasChildNodes) continue; foreach (var node2 in node.ChildNodes.Cast<XmlNode>().Where( node2 => node2.Name.ToLower() == p.DisplayName.ToLower())) { var hash = node.InnerText.Trim(); var password = ComputeHash(String.Join(" ", args).Trim(), new SHA256CryptoServiceProvider()); if (hash == password) { p.SendMessage("Thank you, " + p.Color + p.Username + Server.DefaultColor + "! You are now &averified " + Server.DefaultColor + "and have access to admin commands and features!"); if (p.IsVerified == false) p.IsVerified = true; password = ""; p.ExtraData["PassTries"] = 0; return; } } } /* int foundone = 0; if (args[0] == "") { Help(p); return; } int number = args.Length; if (number > 1) { p.SendMessage("Your password must be &cone " + Server.DefaultColor + "word!"); return; } if (!Directory.Exists("extra/passwords")) { p.SendMessage("You have not &cset a password" + Server.DefaultColor + ", use &a/setpass [Password] " + Server.DefaultColor + "to set one!"); return; } DirectoryInfo di = new DirectoryInfo("extra/passwords/"); FileInfo[] fi = di.GetFiles("*.xml"); Thread.Sleep(10); try { foreach (FileInfo file in fi) { if (file.Name.Replace(".xml", "") == p.Username) { foundone++; } } } catch { p.SendMessage("An Error Occurred! Try again soon!"); return; } if (foundone < 0) { p.SendMessage("You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!"); return; } if (foundone > 1) { p.SendMessage("&cAn error has occurred!"); return; } if (!File.Exists("extra/passwords/" + p.Username + ".xml")) { p.SendMessage("You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!"); return; } Crypto.DecryptStringAES(File.ReadAllText("extra/passwords/" + p.Username + ".xml"), "MCForgeEncryption", p, args[0]); if (args[0] == password) { p.SendMessage("Thank you, " + p.Color + p.Username + Server.DefaultColor + "! You are now &averified " + Server.DefaultColor + "and have &aaccess to admin commands and features!"); if (p.IsVerified == false) p.IsVerified = true; password = ""; p.ExtraData["PassTries"] = 0; return; }*/ p.ExtraData["PassTries"] = (int)p.ExtraData["PassTries"] + 1; p.SendMessage("&cIncorrect Password. " + Server.DefaultColor + "Remember your password is &ccase sensitive!"); p.SendMessage("If you have &cforgotten your password, " + Server.DefaultColor + "contact the server host and they can reset it! &cIncorrect " + Server.DefaultColor + "Tries: &b" + p.ExtraData["PassTries"]); }
public void Use(Player p, string[] args) { if (args.Length == 0) { //Kick the user p.Kick("Congrats! You kicked yourself!"); } else { List<Player> kickeeList = new List<Player>(); //Is it an IP or a name? Server.ForeachPlayer(delegate(Player plr) { if (plr.Ip == args[0] || plr.Username.StartsWith(args[0].ToLower())) kickeeList.Add(plr); //When kicking someone, we don't care for case. }); if (kickeeList.Count == 0) { p.SendMessage("Sorry, but the specified player/IP is not online!"); return; } string reason = string.Join(" ", args, 1).Trim(); if (reason.Length == 0) reason = "You were kicked by " + p.Username; bool kickPlayer = false; foreach (Player kickee in kickeeList) { if (Server.devs.Contains(kickee.Username)) { kickPlayer = true; p.SendMessage("You can't kick the developer " + kickee.Username + "!"); } else kickee.Kick(reason); } if (kickPlayer) { String msg = "You tried to kick a developer! Shame on you!"; if (Server.devs.Contains(p.Username)) p.SendMessage(msg); else p.Kick(msg); } } }