public override void Help(Player p) { Player.SendMessage(p, "/tnt [small/big/nuke] - Creates exploding TNT (with Physics 3)."); Player.SendMessage(p, "Big and Nuke TNT is reserved for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 3)).name + "+"); if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 2)) { Player.SendMessage(p, "/tnt allow - Allows the use of tnt server-wide."); Player.SendMessage(p, "/tnt disallow - Disallows the use of tnt server-wide."); } }
public override void Use(Player p, string message) { string newsFile = "text/news.txt"; if (!File.Exists(newsFile) || (File.Exists(newsFile) && File.ReadAllLines(newsFile).Length == -1)) { using (StreamWriter SW = new StreamWriter(newsFile)) { SW.WriteLine("News have not been created. Put News in '" + newsFile + "'."); } return; } string[] strArray = File.ReadAllLines(newsFile); if (message == "") { for (int j = 0; j < strArray.Length; j++) { Player.SendMessage(p, strArray[j]); } } else { string[] split = message.Split(' '); if (split[0] == "all") { if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this)) { Player.SendMessage(p, "You must be at least " + Group.findPermInt(CommandOtherPerms.GetPerm(this)).name + " to send this to all players."); return; } for (int k = 0; k < strArray.Length; k++) { Player.GlobalMessage(strArray[k]); } return; } else { Player player = Player.Find(split[0]); if (player == null) { Player.SendMessage(p, "Could not find player \"" + split[0] + "\"!"); return; } for (int l = 0; l < strArray.Length; l++) { Player.SendMessage(player, strArray[l]); } Player.SendMessage(p, "The News were successfully sent to " + player.name + "."); return; } } }
public override void Use(Player p, string message) { if (message == "") { message = p.name; } Level lvl; string[] text = new string[2]; text[0] = ""; text[1] = ""; try { text[0] = message.Split(' ')[0].ToLower(); text[1] = message.Split(' ')[1].ToLower(); } catch { } { if (p != null && p.level != null) { lvl = p.level; } else { lvl = Level.Find(text[1]); if (lvl == null) { Player.SendMessage(p, "Level not found!"); return; } } } if (text[0].ToLower() == "all") { if (p != null && (int)p.group.Permission < CommandOtherPerms.GetPerm(this)) { Player.SendMessage(p, "Reserved for " + Group.findPermInt(CommandOtherPerms.GetPerm(this)).name + "+"); return; } foreach (Player who in Player.players.ToArray()) { if (who.level == lvl) { who.Loading = true; foreach (Player pl in Player.players.ToArray()) { if (who.level == pl.level && who != pl) { who.SendDie(pl.id); } } foreach (PlayerBot b in PlayerBot.playerbots.ToArray()) { if (who.level == b.level) { who.SendDie(b.id); } } Player.GlobalDie(who, true); who.SendUserMOTD(); who.SendMap(); ushort x = (ushort)((0.5 + who.level.spawnx) * 32); ushort y = (ushort)((1 + who.level.spawny) * 32); ushort z = (ushort)((0.5 + who.level.spawnz) * 32); if (!who.hidden) { Player.GlobalSpawn(who, x, y, z, who.level.rotx, who.level.roty, true); } else { unchecked { who.SendPos((byte)-1, x, y, z, who.level.rotx, who.level.roty); } } foreach (Player pl in Player.players.ToArray()) { if (pl.level == who.level && who != pl && !pl.hidden) { who.SendSpawn(pl.id, pl.color + pl.name, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1]); } } foreach (PlayerBot b in PlayerBot.playerbots.ToArray()) { if (b.level == who.level) { who.SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]); } } who.Loading = false; if (p != null && !p.hidden) { who.SendMessage("&bMap reloaded by " + p.name); } if (p != null && p.hidden) { who.SendMessage("&bMap reloaded"); } Player.SendMessage(p, "&4Finished reloading for " + who.name); /* * foreach (Player pl in Player.players) if (who.level == pl.level && who != pl) who.SendDie(pl.id); * foreach (PlayerBot b in PlayerBot.playerbots) if (who.level == b.level) who.SendDie(b.id); * Player.GlobalDie(who, true); * * who.SendMap(); * * ushort x = (ushort)((0.5 + who.level.spawnx) * 32); * ushort y = (ushort)((1 + who.level.spawny) * 32); * ushort z = (ushort)((0.5 + who.level.spawnz) * 32); * * Player.GlobalSpawn(who, x, y, z, who.level.rotx, who.level.roty, true); * * foreach (Player pl in Player.players) * if (pl.level == who.level && who != pl && !pl.hidden) * who.SendSpawn(pl.id, pl.color + pl.name, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1]); * * foreach (PlayerBot b in PlayerBot.playerbots) * if (b.level == who.level) * who.SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]); * * who.SendMessage("Map reloaded."); */ } } GC.Collect(); GC.WaitForPendingFinalizers(); } else { Player who = Player.Find(text[0]); if (who == null) { Player.SendMessage(p, "Could not find player."); return; } else if (who.group.Permission > p.group.Permission && p != who) { Player.SendMessage(p, "Cannot reload the map of someone higher than you."); return; } who.Loading = true; foreach (Player pl in Player.players.ToArray()) { if (who.level == pl.level && who != pl) { who.SendDie(pl.id); } } foreach (PlayerBot b in PlayerBot.playerbots.ToArray()) { if (who.level == b.level) { who.SendDie(b.id); } } Player.GlobalDie(who, true); who.SendUserMOTD(); who.SendMap(); ushort x = (ushort)((0.5 + who.level.spawnx) * 32); ushort y = (ushort)((1 + who.level.spawny) * 32); ushort z = (ushort)((0.5 + who.level.spawnz) * 32); if (!who.hidden) { Player.GlobalSpawn(who, x, y, z, who.level.rotx, who.level.roty, true); } else { unchecked { who.SendPos((byte)-1, x, y, z, who.level.rotx, who.level.roty); } } foreach (Player pl in Player.players.ToArray()) { if (pl.level == who.level && who != pl && !pl.hidden) { who.SendSpawn(pl.id, pl.color + pl.name, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1]); } } foreach (PlayerBot b in PlayerBot.playerbots.ToArray()) { if (b.level == who.level) { who.SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]); } } who.Loading = false; GC.Collect(); GC.WaitForPendingFinalizers(); who.SendMessage("&bMap reloaded by " + p.name); Player.SendMessage(p, "&4Finished reloading for " + who.name); /* * foreach (Player pl in Player.players) if (who.level == pl.level && who != pl) who.SendDie(pl.id); * foreach (PlayerBot b in PlayerBot.playerbots) if (who.level == b.level) who.SendDie(b.id); * Player.GlobalDie(who, true); * * who.SendMap(); * * ushort x = (ushort)((0.5 + who.level.spawnx) * 32); * ushort y = (ushort)((1 + who.level.spawny) * 32); * ushort z = (ushort)((0.5 + who.level.spawnz) * 32); * * Player.GlobalSpawn(who, x, y, z, who.level.rotx, who.level.roty, true); * * foreach (Player pl in Player.players) * if (pl.level == who.level && who != pl && !pl.hidden) * who.SendSpawn(pl.id, pl.color + pl.name, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1]); * * foreach (PlayerBot b in PlayerBot.playerbots) * if (b.level == who.level) * who.SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]); * * who.SendMessage("Map reloaded."); */ } }
public override void Help(Player p) { Player.SendMessage(p, "/patrol - Teleports you to a random " + Group.findPermInt(CommandOtherPerms.GetPerm(this)).name + " or lower"); }
public override void Use(Player p, string message) { int height; int radius; if (p != null) { if (p.level.permissionbuild > p.group.Permission) { p.SendMessage("You can not edit this map."); return; } string[] message2 = message.Split(' '); #region cones if (message2[0].ToLower() == "cone") { if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 1)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 1)).name + "+"); return; } if (message2.Length != 3) { goto Help; } try { height = Convert.ToUInt16(message2[1].Trim()); radius = Convert.ToUInt16(message2[2].Trim()); p.BcVar = new int[2] { height, radius }; } catch { goto Help; } p.SendMessage("Place a block"); p.ClearBlockchange(); p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeCone); return; } if (message2[0].ToLower() == "hcone") { if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 1)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 1)).name + "+"); return; } if (message2.Length != 3) { goto Help; } try { height = Convert.ToUInt16(message2[1].Trim()); radius = Convert.ToUInt16(message2[2].Trim()); p.BcVar = new int[2] { height, radius }; } catch { goto Help; } p.SendMessage("Place a block"); p.ClearBlockchange(); p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeHCone); return; } if (message2[0].ToLower() == "icone") { if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 1)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 1)).name + "+"); return; } if (message2.Length != 3) { goto Help; } try { height = Convert.ToUInt16(message2[1].Trim()); radius = Convert.ToUInt16(message2[2].Trim()); p.BcVar = new int[2] { height, radius }; } catch { goto Help; } p.SendMessage("Place a block"); p.ClearBlockchange(); p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeICone); return; } if (message2[0].ToLower() == "hicone") { if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 1)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 1)).name + "+"); return; } if (message2.Length != 3) { goto Help; } try { height = Convert.ToUInt16(message2[1].Trim()); radius = Convert.ToUInt16(message2[2].Trim()); p.BcVar = new int[2] { height, radius }; } catch { goto Help; } p.SendMessage("Place a block"); p.ClearBlockchange(); p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeHICone); return; } #endregion #region pyramids if (message2[0].ToLower() == "pyramid") { if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 2)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 2)).name + "+"); return; } if (message2.Length != 3) { goto Help; } try { height = Convert.ToUInt16(message2[1].Trim()); radius = Convert.ToUInt16(message2[2].Trim()); p.BcVar = new int[2] { height, radius }; } catch { goto Help; } p.SendMessage("Place a block"); p.ClearBlockchange(); p.Blockchange += new Player.BlockchangeEventHandler(BlockchangePyramid); return; } if (message2[0].ToLower() == "hpyramid") { if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 2)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 2)).name + "+"); return; } if (message2.Length != 3) { goto Help; } try { height = Convert.ToUInt16(message2[1].Trim()); radius = Convert.ToUInt16(message2[2].Trim()); p.BcVar = new int[2] { height, radius }; } catch { goto Help; } p.SendMessage("Place a block"); p.ClearBlockchange(); p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeHPyramid); return; } if (message2[0].ToLower() == "ipyramid") { if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 2)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 2)).name + "+"); return; } if (message2.Length != 3) { goto Help; } try { height = Convert.ToUInt16(message2[1].Trim()); radius = Convert.ToUInt16(message2[2].Trim()); p.BcVar = new int[2] { height, radius }; } catch { goto Help; } p.SendMessage("Place a block"); p.ClearBlockchange(); p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeIPyramid); return; } if (message2[0].ToLower() == "hipyramid") { if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 2)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 2)).name + "+"); return; } if (message2.Length != 3) { goto Help; } try { height = Convert.ToUInt16(message2[1].Trim()); radius = Convert.ToUInt16(message2[2].Trim()); p.BcVar = new int[2] { height, radius }; } catch { goto Help; } p.SendMessage("Place a block"); p.ClearBlockchange(); p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeHIPyramid); return; } #endregion #region spheres if (message2[0].ToLower() == "sphere") { if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 3)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 3)).name + "+"); return; } if (message2.Length != 2) { goto Help; } try { radius = Convert.ToUInt16(message2[1].Trim()); p.BcVar = new int[2] { 0, radius }; } catch { goto Help; } p.SendMessage("Place a block"); p.ClearBlockchange(); p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeSphere); return; } if (message2[0].ToLower() == "hsphere") { if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 3)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 3)).name + "+"); return; } if (message2.Length != 2) { goto Help; } try { radius = Convert.ToUInt16(message2[1].Trim()); p.BcVar = new int[2] { 0, radius }; } catch { goto Help; } p.SendMessage("Place a block"); p.ClearBlockchange(); p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeHSphere); return; } #endregion #region other if (message2[0].ToLower() == "volcano") { if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 4)) { Player.SendMessage(p, "That commands addition is for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 4)).name + "+"); return; } if (message2.Length != 3) { goto Help; } try { height = Convert.ToUInt16(message2[1].Trim()); radius = Convert.ToUInt16(message2[2].Trim()); p.BcVar = new int[2] { height, radius }; } catch { goto Help; } p.SendMessage("Place a block"); p.ClearBlockchange(); p.Blockchange += new Player.BlockchangeEventHandler(BlockchangeValcano); return; } #endregion Help: Help(p); return; } Player.SendMessage(p, "This command can only be used in-game!"); }
public override void Use(Player p, string message) { if (message == "") { message = p.level.name; } Level foundLevel; if (message.IndexOf(' ') == -1) { foundLevel = Level.Find(message); if (foundLevel == null) { if (p != null) { foundLevel = p.level; } } else { gettinginfo = true; Player.SendMessage(p, "MOTD: &b" + foundLevel.motd); Player.SendMessage(p, "Finite mode: " + FoundCheck(foundLevel, foundLevel.finite)); Player.SendMessage(p, "Random flow: " + FoundCheck(foundLevel, foundLevel.randomFlow)); Player.SendMessage(p, "Animal AI: " + FoundCheck(foundLevel, foundLevel.ai)); Player.SendMessage(p, "Edge water: " + FoundCheck(foundLevel, foundLevel.edgeWater)); Player.SendMessage(p, "Grass growing: " + FoundCheck(foundLevel, foundLevel.GrassGrow)); Player.SendMessage(p, "Tree growing: " + FoundCheck(foundLevel, foundLevel.growTrees)); Player.SendMessage(p, "Leaf decay: " + FoundCheck(foundLevel, foundLevel.leafDecay)); Player.SendMessage(p, "Physics speed: &b" + foundLevel.speedPhysics); Player.SendMessage(p, "Physics overload: &b" + foundLevel.overload); Player.SendMessage(p, "Survival death: " + FoundCheck(foundLevel, foundLevel.Death) + "(Fall: " + foundLevel.fall + ", Drown: " + foundLevel.drown + ")"); Player.SendMessage(p, "Killer blocks: " + FoundCheck(foundLevel, foundLevel.Killer)); Player.SendMessage(p, "Unload: " + FoundCheck(foundLevel, foundLevel.unload)); Player.SendMessage(p, "Load on /goto: " + FoundCheck(foundLevel, foundLevel.loadOnGoto)); Player.SendMessage(p, "Auto physics: " + FoundCheck(foundLevel, foundLevel.rp)); Player.SendMessage(p, "Instant building: " + FoundCheck(foundLevel, foundLevel.Instant)); Player.SendMessage(p, "RP chat: " + FoundCheck(foundLevel, !foundLevel.worldChat)); Player.SendMessage(p, "Guns: " + FoundCheck(foundLevel, foundLevel.guns)); gettinginfo = false; return; } } else { foundLevel = Level.Find(message.Split(' ')[0]); if (foundLevel == null || message.Split(' ')[0].ToLower() == "ps" || message.Split(' ')[0].ToLower() == "rp") { foundLevel = p.level; } else { message = message.Substring(message.IndexOf(' ') + 1); } } if (p != null) { if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this)) { Player.SendMessage(p, "Setting map options is reserved to " + Group.findPermInt(CommandOtherPerms.GetPerm(this)).name + "+"); return; } } string foundStart; if (message.IndexOf(' ') == -1) { foundStart = message.ToLower(); } else { foundStart = message.Split(' ')[0].ToLower(); } try { if (foundLevel == null) { Player.SendMessage(p, "derp"); } switch (foundStart) { case "theme": foundLevel.theme = message.Substring(message.IndexOf(' ') + 1); foundLevel.ChatLevel("Map theme: &b" + foundLevel.theme); break; case "finite": foundLevel.finite = !foundLevel.finite; foundLevel.ChatLevel("Finite mode: " + FoundCheck(foundLevel, foundLevel.finite)); if (p == null) { Player.SendMessage(p, "Finite mode: " + FoundCheck(foundLevel, foundLevel.finite, true)); } break; case "ai": foundLevel.ai = !foundLevel.ai; foundLevel.ChatLevel("Animal AI: " + FoundCheck(foundLevel, foundLevel.ai)); if (p == null) { Player.SendMessage(p, "Animal AI: " + FoundCheck(foundLevel, foundLevel.ai, true)); } break; case "edge": foundLevel.edgeWater = !foundLevel.edgeWater; foundLevel.ChatLevel("Edge water: " + FoundCheck(foundLevel, foundLevel.edgeWater)); if (p == null) { Player.SendMessage(p, "Edge water: " + FoundCheck(foundLevel, foundLevel.edgeWater, true)); } break; case "grass": foundLevel.GrassGrow = !foundLevel.GrassGrow; foundLevel.ChatLevel("Growing grass: " + FoundCheck(foundLevel, foundLevel.GrassGrow)); if (p == null) { Player.SendMessage(p, "Growing grass: " + FoundCheck(foundLevel, foundLevel.GrassGrow, true)); } break; case "ps": case "physicspeed": if (int.Parse(message.Split(' ')[1]) < 10) { Player.SendMessage(p, "Cannot go below 10"); return; } foundLevel.speedPhysics = int.Parse(message.Split(' ')[1]); foundLevel.ChatLevel("Physics speed: &b" + foundLevel.speedPhysics); break; case "overload": if (int.Parse(message.Split(' ')[1]) < 500) { Player.SendMessage(p, "Cannot go below 500 (default is 1500)"); return; } if (p != null && p.group.Permission < LevelPermission.Admin && int.Parse(message.Split(' ')[1]) > 2500) { Player.SendMessage(p, "Only SuperOPs may set higher than 2500"); return; } foundLevel.overload = int.Parse(message.Split(' ')[1]); foundLevel.ChatLevel("Physics overload: &b" + foundLevel.overload); break; case "motd": if (message.Split(' ').Length == 1) { foundLevel.motd = "ignore"; } else { foundLevel.motd = message.Substring(message.IndexOf(' ') + 1); } foundLevel.ChatLevel("Map MOTD: &b" + foundLevel.motd); break; case "death": foundLevel.Death = !foundLevel.Death; foundLevel.ChatLevel("Survival death: " + FoundCheck(foundLevel, foundLevel.Death)); if (p == null) { Player.SendMessage(p, "Survival death: " + FoundCheck(foundLevel, foundLevel.Death, true)); } break; case "killer": foundLevel.Killer = !foundLevel.Killer; foundLevel.ChatLevel("Killer blocks: " + FoundCheck(foundLevel, foundLevel.Killer)); if (p == null) { Player.SendMessage(p, "Killer blocks: " + FoundCheck(foundLevel, foundLevel.Killer, true)); } break; case "fall": foundLevel.fall = int.Parse(message.Split(' ')[1]); foundLevel.ChatLevel("Fall distance: &b" + foundLevel.fall); break; case "drown": foundLevel.drown = int.Parse(message.Split(' ')[1]) * 10; foundLevel.ChatLevel("Drown time: &b" + (foundLevel.drown / 10)); break; case "unload": foundLevel.unload = !foundLevel.unload; foundLevel.ChatLevel("Auto unload: " + FoundCheck(foundLevel, foundLevel.unload)); if (p == null) { Player.SendMessage(p, "Auto unload: " + FoundCheck(foundLevel, foundLevel.unload, true)); } break; case "rp": case "restartphysics": foundLevel.rp = !foundLevel.rp; foundLevel.ChatLevel("Auto physics: " + FoundCheck(foundLevel, foundLevel.rp)); if (p == null) { Player.SendMessage(p, "Auto physics: " + FoundCheck(foundLevel, foundLevel.rp, true)); } break; case "instant": if (p != null && p.group.Permission < LevelPermission.Admin) { Player.SendMessage(p, "This is reserved for Super+"); return; } foundLevel.Instant = !foundLevel.Instant; foundLevel.ChatLevel("Instant building: " + FoundCheck(foundLevel, foundLevel.Instant)); if (p == null) { Player.SendMessage(p, "Instant building: " + FoundCheck(foundLevel, foundLevel.Instant, true)); } break; case "chat": foundLevel.worldChat = !foundLevel.worldChat; foundLevel.ChatLevel("RP chat: " + FoundCheck(foundLevel, !foundLevel.worldChat)); if (p == null) { Player.SendMessage(p, "RP chat: " + FoundCheck(foundLevel, !foundLevel.worldChat, true)); } break; case "load": case "autoload": case "loadongoto": foundLevel.loadOnGoto = !foundLevel.loadOnGoto; foundLevel.ChatLevel("Load on /goto: " + FoundCheck(foundLevel, foundLevel.loadOnGoto)); if (p == null) { Player.SendMessage(p, "Load on /goto: " + FoundCheck(foundLevel, foundLevel.loadOnGoto, true)); } break; case "leaf": case "leafdecay": foundLevel.leafDecay = !foundLevel.leafDecay; foundLevel.ChatLevel("Leaf decay: " + FoundCheck(foundLevel, foundLevel.leafDecay)); if (p == null) { Player.SendMessage(p, "Leaf decay: " + FoundCheck(foundLevel, foundLevel.leafDecay, true)); } break; case "flow": case "randomflow": foundLevel.randomFlow = !foundLevel.randomFlow; foundLevel.ChatLevel("Random flow: " + FoundCheck(foundLevel, foundLevel.randomFlow)); if (p == null) { Player.SendMessage(p, "Random flow: " + FoundCheck(foundLevel, foundLevel.randomFlow, true)); } break; case "tree": case "growtrees": foundLevel.growTrees = !foundLevel.growTrees; foundLevel.ChatLevel("Tree growing: " + FoundCheck(foundLevel, foundLevel.growTrees)); if (p == null) { Player.SendMessage(p, "Tree growing: " + FoundCheck(foundLevel, foundLevel.growTrees, true)); } break; default: Player.SendMessage(p, "Could not find option entered."); return; } foundLevel.changed = true; if (p != null && p.level != foundLevel) { Player.SendMessage(p, "/map finished!"); } } catch { Player.SendMessage(p, "INVALID INPUT"); } }
public override void Use(Player p, string message) { try { if (message == "") { Help(p); return; } if (message.IndexOf(' ') == -1) { if (File.Exists("extra/copy/" + message + ".copy")) { Player.SendMessage(p, "File: &f" + message + Server.DefaultColor + " already exists. Delete first"); return; } else { Player.SendMessage(p, "Storing: " + message); File.Create("extra/copy/" + message + ".copy").Dispose(); using (StreamWriter sW = File.CreateText("extra/copy/" + message + ".copy")) { sW.WriteLine("Saved by: " + p.name + " at " + DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss ")); for (int k = 0; k < p.CopyBuffer.Count; k++) { sW.WriteLine(p.CopyBuffer[k].x + " " + p.CopyBuffer[k].y + " " + p.CopyBuffer[k].z + " " + p.CopyBuffer[k].type); } } using (StreamWriter sW = File.AppendText("extra/copy/index.copydb")) { sW.WriteLine(message + " " + p.name); } } } else { if (message.Split(' ')[0] == "delete") { message = message.Split(' ')[1]; list.Clear(); foreach (string s in File.ReadAllLines("extra/copy/index.copydb")) { CopyOwner cO = new CopyOwner(); cO.file = s.Split(' ')[0]; cO.name = s.Split(' ')[1]; list.Add(cO); } CopyOwner result = list.Find( delegate(CopyOwner cO) { return(cO.file == message); } ); if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this) || result.name == p.name) { if (File.Exists("extra/copy/" + message + ".copy")) { try { if (File.Exists("extra/copyBackup/" + message + ".copy")) { File.Delete("extra/copyBackup/" + message + ".copy"); } File.Move("extra/copy/" + message + ".copy", "extra/copyBackup/" + message + ".copy"); } catch { } Player.SendMessage(p, "File &f" + message + Server.DefaultColor + " has been deleted."); list.Remove(result); File.Create("extra/copy/index.copydb").Dispose(); using (StreamWriter sW = File.CreateText("extra/copy/index.copydb")) { foreach (CopyOwner cO in list) { sW.WriteLine(cO.file + " " + cO.name); } } } else { Player.SendMessage(p, "File does not exist."); } } else { Player.SendMessage(p, "You must be an " + Group.findPermInt(CommandOtherPerms.GetPerm(this)).name + "+ or file owner to delete a save."); return; } } else { Help(p); return; } } } catch (Exception e) { Server.ErrorLog(e); } }
public override void Help(Player p) { Player.SendMessage(p, "/store <filename> - Stores your copied item to the server as <filename>."); Player.SendMessage(p, "/store delete <filename> - Deletes saved copy file. Only " + Group.findPermInt(CommandOtherPerms.GetPerm(this)).name + "+ and file creator may delete."); }
public override void Use(Player p, string message) { if (p == null) { Player.SendMessage(p, "This command can only be used in-game"); return; } string[] command = message.ToLower().Split(' '); string par0 = String.Empty; string par1 = String.Empty; string par2 = String.Empty; try { par0 = command[0]; par1 = command[1]; par2 = command[2]; } catch { } if (par0 == "list" || par0 == "view" || par0 == "l" || par0 == "v") { Player.SendMessage(p, "Warps:"); foreach (Warp.Wrp wr in Warp.Warps) { if (Level.Find(wr.lvlname) != null) { Player.SendMessage(p, wr.name + " : " + wr.lvlname); Thread.Sleep(300); // I feel this is needed so that if there are a lot of warps, they do not immediatly go off the screen! } } return; } if (par0 == "create" || par0 == "add" || par0 == "c" || par0 == "a") { if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 1)) { if (par1 == null) { Player.SendMessage(p, "You didn't specify a name for the warp!"); return; } if (Warp.WarpExists(par1)) { Player.SendMessage(p, "Warp has already been created!!"); return; } { if (par2 == null) { Warp.AddWarp(par1, p); } else { Warp.AddWarp(par1, Player.Find(par2)); } } { if (Warp.WarpExists(par1)) { Player.SendMessage(p, "Warp created!"); return; } else { Player.SendMessage(p, "Warp creation failed!!"); return; } } } else { Player.SendMessage(p, "You can't use that because you aren't a" + Group.findPermInt(CommandOtherPerms.GetPerm(this, 1)).name + "+"); return; } } if (par0 == "delete" || par0 == "remove" || par0 == "d" || par0 == "r") { if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 2)) { if (par1 == null) { Player.SendMessage(p, "You didn't specify a warp to delete!"); return; } if (!Warp.WarpExists(par1)) { Player.SendMessage(p, "Warp doesn't exist!!"); return; } { Warp.DeleteWarp(par1); } { if (!Warp.WarpExists(par1)) { Player.SendMessage(p, "Warp deleted!"); return; } else { Player.SendMessage(p, "Warp deletion failed!!"); return; } } } else { Player.SendMessage(p, "You can't use that because you aren't a" + Group.findPermInt(CommandOtherPerms.GetPerm(this, 2)).name + "+"); return; } } if (par0 == "move" || par0 == "change" || par0 == "edit" || par0 == "m" || par0 == "e") { if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 3)) { if (par1 == null) { Player.SendMessage(p, "You didn't specify a warp to be moved!"); return; } if (!Warp.WarpExists(par1)) { Player.SendMessage(p, "Warp doesn't exist!!"); return; } { if (par2 == null) { Warp.MoveWarp(par1, p); } else { Warp.MoveWarp(par1, Player.Find(par2)); } } { if (Warp.WarpExists(par1)) { Player.SendMessage(p, "Warp moved!"); return; } else { Player.SendMessage(p, "Warp moving failed!!"); return; } } } else { Player.SendMessage(p, "You can't use that because you aren't a " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 3)).name + "+"); return; } } else { if (Warp.WarpExists(par0) == true) { Warp.Wrp w = new Warp.Wrp(); w = Warp.GetWarp(par0); Level lvl = Level.Find(w.lvlname); if (lvl != null) { if (p.level != lvl) { if (lvl.permissionvisit > p.group.Permission) { Player.SendMessage(p, "Sorry, you aren't a high enough rank to visit the map that that warp is on."); return; } Command.all.Find("goto").Use(p, lvl.name); while (p.Loading) { Thread.Sleep(250); } } unchecked { p.SendPos((byte)-1, w.x, w.y, w.z, w.rotx, w.roty); } return; } else { Player.SendMessage(p, "The level that that warp is on (" + w.lvlname + ") either no longer exists or is currently unloaded"); return; } } else { Player.SendMessage(p, "That is not a command addition or a warp"); return; } } }
public override void Use(Player p, string message) { CatchPos cpos; if (message == "") { p.ZoneCheck = true; Player.SendMessage(p, "Place a block where you would like to check for zones."); return; } else if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 1)) { Player.SendMessage(p, "Reserved for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 1)).name + "+"); return; } if (message.IndexOf(' ') == -1) { if (p.canBuild == true) //Checks if player can build there { switch (message.ToLower()) //If true - they can delete the zone { case "del": p.zoneDel = true; Player.SendMessage(p, "Place a block where you would like to delete a zone."); return; default: Help(p); return; } } else //if they cant, it warns them, the ops and logs it on the server! { Player.SendMessage(p, "You can't delete a zone which is above your rank!"); Player.GlobalMessageOps(p.name + " tried to delete a zone that is above their rank!"); Server.s.Log(p.name + " tried to delete a zone that is above their rank!"); return; } } if (message.ToLower() == "del all") { if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 2)) { Player.SendMessage(p, "Only a " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 2)).name + "+ may delete all zones at once"); return; } else { for (int i = 0; i < p.level.ZoneList.Count; i++) { Level.Zone Zn = p.level.ZoneList[i]; if (Server.useMySQL) { MySQL.executeQuery("DELETE FROM `Zone" + p.level.name + "` WHERE Owner='" + Zn.Owner + "' AND SmallX='" + Zn.smallX + "' AND SMALLY='" + Zn.smallY + "' AND SMALLZ='" + Zn.smallZ + "' AND BIGX='" + Zn.bigX + "' AND BIGY='" + Zn.bigY + "' AND BIGZ='" + Zn.bigZ + "'"); } else { SQLite.executeQuery("DELETE FROM `Zone" + p.level.name + "` WHERE Owner='" + Zn.Owner + "' AND SmallX='" + Zn.smallX + "' AND SMALLY='" + Zn.smallY + "' AND SMALLZ='" + Zn.smallZ + "' AND BIGX='" + Zn.bigX + "' AND BIGY='" + Zn.bigY + "' AND BIGZ='" + Zn.bigZ + "'"); } Player.SendMessage(p, "Zone deleted for &b" + Zn.Owner); p.level.ZoneList.Remove(p.level.ZoneList[i]); if (i == p.level.ZoneList.Count) { Player.SendMessage(p, "Finished removing all zones"); return; } i--; } } } if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 3)) { Player.SendMessage(p, "Setting zones is reserved for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 3)).name); return; } if (Group.Find(message.Split(' ')[1]) != null) { message = message.Split(' ')[0] + " grp" + Group.Find(message.Split(' ')[1]).name; } if (message.Split(' ')[0].ToLower() == "add") { Player foundPlayer = Player.Find(message.Split(' ')[1]); if (foundPlayer == null) { cpos.Owner = message.Split(' ')[1].ToString(); } else { cpos.Owner = foundPlayer.name; } } else { Help(p); return; } if (!Player.ValidName(cpos.Owner)) { Player.SendMessage(p, "INVALID NAME."); return; } cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos; Player.SendMessage(p, "Place two blocks to determine the edges."); Player.SendMessage(p, "Zone for: &b" + cpos.Owner + "."); p.ClearBlockchange(); p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); }
public override void Use(Player p, string message) { if (message == "") { Help(p); return; } try { if (message.Split(' ').Length == 1) { PlayerBot pB = PlayerBot.Find(message); try { pB.Waypoints.Clear(); } catch { } pB.kill = false; pB.hunt = false; pB.AIName = ""; Player.SendMessage(p, pB.color + pB.name + Server.DefaultColor + "'s AI was turned off."); Server.s.Log(pB.name + "'s AI was turned off."); return; } else if (message.Split(' ').Length != 2) { Help(p); return; } PlayerBot Pb = PlayerBot.Find(message.Split(' ')[0]); if (Pb == null) { Player.SendMessage(p, "Could not find specified Bot"); return; } string foundPath = message.Split(' ')[1].ToLower(); if (foundPath == "hunt") { Pb.hunt = !Pb.hunt; try { Pb.Waypoints.Clear(); } catch { } Pb.AIName = ""; if (p != null) { Player.GlobalChatLevel(p, Pb.color + Pb.name + Server.DefaultColor + "'s hunt instinct: " + Pb.hunt, false); } Server.s.Log(Pb.name + "'s hunt instinct: " + Pb.hunt); return; } else if (foundPath == "kill") { if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this)) { Player.SendMessage(p, "Only a " + Group.findPermInt(CommandOtherPerms.GetPerm(this)).name + "+ may toggle killer instinct."); return; } Pb.kill = !Pb.kill; if (p != null) { Player.GlobalChatLevel(p, Pb.color + Pb.name + Server.DefaultColor + "'s kill instinct: " + Pb.kill, false); } Server.s.Log(Pb.name + "'s kill instinct: " + Pb.kill); return; } if (!File.Exists("bots/" + foundPath)) { Player.SendMessage(p, "Could not find specified AI."); return; } string[] foundWay = File.ReadAllLines("bots/" + foundPath); if (foundWay[0] != "#Version 2") { Player.SendMessage(p, "Invalid file version. Remake"); return; } PlayerBot.Pos newPos = new PlayerBot.Pos(); try { Pb.Waypoints.Clear(); Pb.currentPoint = 0; Pb.countdown = 0; Pb.movementSpeed = 12; } catch { } try { foreach (string s in foundWay) { if (s != "" && s[0] != '#') { bool skip = false; newPos.type = s.Split(' ')[0]; switch (s.Split(' ')[0].ToLower()) { case "walk": case "teleport": newPos.x = Convert.ToUInt16(s.Split(' ')[1]); newPos.y = Convert.ToUInt16(s.Split(' ')[2]); newPos.z = Convert.ToUInt16(s.Split(' ')[3]); newPos.rotx = Convert.ToByte(s.Split(' ')[4]); newPos.roty = Convert.ToByte(s.Split(' ')[5]); break; case "wait": case "speed": newPos.seconds = Convert.ToInt16(s.Split(' ')[1]); break; case "nod": case "spin": newPos.seconds = Convert.ToInt16(s.Split(' ')[1]); newPos.rotspeed = Convert.ToInt16(s.Split(' ')[2]); break; case "linkscript": newPos.newscript = s.Split(' ')[1]; break; case "reset": case "jump": case "remove": break; default: skip = true; break; } if (!skip) { Pb.Waypoints.Add(newPos); } } } } catch { Player.SendMessage(p, "AI file corrupt."); return; } Pb.AIName = foundPath; if (p != null) { Player.GlobalChatLevel(p, Pb.color + Pb.name + Server.DefaultColor + "'s AI is now set to " + foundPath, false); } Server.s.Log(Pb.name + "'s AI was set to " + foundPath); } catch { Player.SendMessage(p, "Error"); return; } }
public override void Use(Player p, string message) { if (message.Split(' ').Length > 1) { Help(p); return; } if (p.BlockAction == 13 || p.BlockAction == 14) { if (p.allowTnt == false) { Player.SendMessage(p, "Tnt usage is not allowed at the moment!"); return; } p.BlockAction = 0; Player.SendMessage(p, "TNT mode is now &cOFF" + Server.DefaultColor + "."); } else if (message.ToLower() == "small" || message == "") { if (p.allowTnt == true) { p.BlockAction = 13; Player.SendMessage(p, "TNT mode is now &aON" + Server.DefaultColor + "."); return; } Player.SendMessage(p, "Tnt usage is not allowed at the moment!"); return; } else if (message.ToLower() == "big") { if (p.allowTnt == false) { Player.SendMessage(p, "Tnt usage is not allowed at the moment!"); return; } if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 1)) { p.BlockAction = 14; Player.SendMessage(p, "TNT (Big) mode is now &aON" + Server.DefaultColor + "."); } else { Player.SendMessage(p, "This mode is reserved for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 1)).name + "+"); } } else if (message.ToLower() == "allow") { if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 2)) { p.allowTnt = true; Player.SendMessage(p, "&cTnt usage has now been enabled!"); return; } Player.SendMessage(p, "You must be " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 2)).name + "+ to use this command."); return; } else if (message.ToLower() == "disallow") { if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 2)) { p.allowTnt = false; Player.SendMessage(p, "&cTnt usage has now been disabled!"); return; } Player.SendMessage(p, "You must be " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 2)).name + "+ to use this command."); return; } else if (message.ToLower() == "nuke") { if (p.allowTnt == false) { Player.SendMessage(p, "Tnt usage is not allowed at the moment!"); return; } if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 3)) { p.BlockAction = 15; Player.SendMessage(p, "TNT (Nuke) mode is now &aON" + Server.DefaultColor + "."); } else { Player.SendMessage(p, "This mode is reserved for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 3)).name + "+"); } } else { Help(p); } p.painting = false; }
int MAX = -1; // This is the value changed to MAX in the Undo list, and used to allow everything undone. public override void Use(Player p, string message) { byte b; long seconds = -2; Player who = null; Player.UndoPos Pos; int CurrentPos = 0; bool undoPhysics = false; string whoName = String.Empty; if (p != null) { p.RedoBuffer.Clear(); } if (message == "") { if (p == null) { Player.SendMessage(null, "Console doesn't have an undo buffer."); return; } else { message = p.name.ToLower() + " 30"; } } try { if (message.Split(' ').Length > 1) { whoName = message.Split(' ')[0]; who = message.Split(' ')[0].ToLower() == "physics" ? null : Player.Find(message.Split(' ')[0]); undoPhysics = message.Split(' ')[0].ToLower() == "physics"; message = message.Split(' ')[1].ToLower(); } else { who = (p == null || message.ToLower() == "physics") ? null : p; undoPhysics = message.ToLower() == "physics"; } //If user is undoing him/herself, then all is go. //If user is undoing someone else, then restrictions are used. if (p == who) { seconds = ((message.ToLower() != "all") ? long.Parse(message) : int.MaxValue); } else { seconds = getAllowed(p, message.ToLower()); } } catch { Player.SendMessage(p, "Invalid seconds, or you're unable to use /xundo. Using 30 seconds."); //only run if seconds is an invalid number seconds = 30; } //At this point, we know the number is valid, and allowed for the particular person's group. if (who != null) { if (p != null) { if (who.group.Permission > p.group.Permission && who != p) { Player.SendMessage(p, "Cannot undo a user of higher or equal rank"); return; } if (who != p && (int)p.group.Permission < CommandOtherPerms.GetPerm(this, 1)) { Player.SendMessage(p, "Only an " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 1)).name + "+ may undo other people's actions"); return; } } for (CurrentPos = who.UndoBuffer.Count - 1; CurrentPos >= 0; --CurrentPos) { try { Pos = who.UndoBuffer[CurrentPos]; Level foundLevel = Level.FindExact(Pos.mapName); b = foundLevel.GetTile(Pos.x, Pos.y, Pos.z); if (Pos.timePlaced.AddSeconds(seconds) >= DateTime.Now) { if (b == Pos.newtype || Block.Convert(b) == Block.water || Block.Convert(b) == Block.lava) { foundLevel.Blockchange(Pos.x, Pos.y, Pos.z, Pos.type, true); Pos.newtype = Pos.type; Pos.type = b; if (p != null) { p.RedoBuffer.Add(Pos); } who.UndoBuffer.RemoveAt(CurrentPos); } } else { break; } } catch { } } if (p == who) { Player.SendMessage(p, "Undid your actions for the past &b" + seconds + Server.DefaultColor + " seconds."); } else { Player.GlobalChat(who, who.color + who.name + Server.DefaultColor + "'s actions for the past &b" + seconds + " seconds were undone.", false); // Also notify console Server.s.Log(who.name + "'s actions for the past " + seconds + " seconds were undone."); } return; } else if (undoPhysics) { if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 2)) { Player.SendMessage(p, "Reserved for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 2)).name + "+"); return; } if (!p.group.CanExecute(Command.all.Find("physics"))) { Player.SendMessage(p, "You can only undo physics if you can use them."); return; } Command.all.Find("physics").Use(p, "0"); Level.UndoPos uP; ushort x, y, z; if (p.level.UndoBuffer.Count != Server.physUndo) { for (CurrentPos = p.level.currentUndo; CurrentPos >= 0; CurrentPos--) { try { uP = p.level.UndoBuffer[CurrentPos]; b = p.level.GetTile(uP.location); if (uP.timePerformed.AddSeconds(seconds) >= DateTime.Now) { if (b == uP.newType || Block.Convert(b) == Block.water || Block.Convert(b) == Block.lava) { p.level.IntToPos(uP.location, out x, out y, out z); p.level.Blockchange(p, x, y, z, uP.oldType, true); } } else { break; } } catch { } } } else { for (CurrentPos = p.level.currentUndo; CurrentPos != p.level.currentUndo + 1; CurrentPos--) { try { if (CurrentPos < 0) { CurrentPos = p.level.UndoBuffer.Count - 1; } uP = p.level.UndoBuffer[CurrentPos]; b = p.level.GetTile(uP.location); if (uP.timePerformed.AddSeconds(seconds) >= DateTime.Now) { if (b == uP.newType || Block.Convert(b) == Block.water || Block.Convert(b) == Block.lava) { p.level.IntToPos(uP.location, out x, out y, out z); p.level.Blockchange(p, x, y, z, uP.oldType, true); } } else { break; } } catch { } } } Player.GlobalMessage("Physics were undone &b" + seconds + Server.DefaultColor + " seconds"); // Also notify console Player.SendMessage(null, "Physics were undone &b" + seconds + Server.DefaultColor + " seconds"); } else // Here, who == null, meaning the user specified is offline { if (p != null) { if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this, 1)) { Player.SendMessage(p, "Reserved for " + Group.findPermInt(CommandOtherPerms.GetPerm(this, 1)).name + "+"); return; } // ^^^ is using the same as the 1st other permission for the this command because the only difference is that this is for offline players so it might aswell be the same!! } bool FoundUser = false; try { DirectoryInfo di; string[] fileContent; if (p != null) { p.RedoBuffer.Clear(); } if (Directory.Exists("extra/undo/" + whoName.ToLower())) { di = new DirectoryInfo("extra/undo/" + whoName.ToLower()); for (int i = di.GetFiles("*.undo").Length - 1; i >= 0; i--) { fileContent = File.ReadAllText("extra/undo/" + whoName.ToLower() + "/" + i + ".undo").Split(' '); if (!undoBlah(fileContent, seconds, p)) { break; } } FoundUser = true; } if (Directory.Exists("extra/undoPrevious/" + whoName.ToLower())) { di = new DirectoryInfo("extra/undoPrevious/" + whoName.ToLower()); for (int i = di.GetFiles("*.undo").Length - 1; i >= 0; i--) { fileContent = File.ReadAllText("extra/undoPrevious/" + whoName.ToLower() + "/" + i + ".undo").Split(' '); if (!undoBlah(fileContent, seconds, p)) { break; } } FoundUser = true; } if (FoundUser) { Player.GlobalMessage(Server.FindColor(whoName) + whoName + Server.DefaultColor + "'s actions for the past &b" + seconds + Server.DefaultColor + " seconds were undone."); // Also notify console Server.s.Log(whoName + "'s actions for the past " + seconds + " seconds were undone."); } else { Player.SendMessage(p, "Could not find player specified."); } } catch (Exception e) { Server.ErrorLog(e); } } }
public override void Use(Player p, string message) { if (p == null) { Player.SendMessage(p, "This command can not be used in console!"); return; } int number = message.Split(' ').Length; if (message == "") { Help(p); return; } if (number == 1) { if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this)) { Player.SendMessage(p, "You need to be a " + Group.findPermInt(CommandOtherPerms.GetPerm(this)).name + "+ to do that!"); return; } if (message.ToLower() == "check") { if (!Directory.Exists("extra/reported")) { Directory.CreateDirectory("extra/reported"); } bool foundone = false; DirectoryInfo di = new DirectoryInfo("extra/reported"); FileInfo[] fi = di.GetFiles("*.txt"); Player.SendMessage(p, "The following players have been reported:"); foreach (FileInfo file in fi) { foundone = true; var parsed = file.Name.Replace(".txt", ""); Player.SendMessage(p, "- " + parsed); } if (foundone == true) { Player.SendMessage(p, "Use /report view [Player] to view the reason and the reporter."); Player.SendMessage(p, "Use /report remove [Player] to remove the report on a player."); } else { Player.SendMessage(p, "No reports were found!"); return; } return; } } if (number >= 2) { int pos = message.IndexOf(' '); string msg1 = message.Substring(0, pos).ToLower(); string msg2 = message.Substring(pos + 1).ToLower(); if (msg1.ToLower() == "view") { if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this)) { Player.SendMessage(p, "You need to be a " + Group.findPermInt(CommandOtherPerms.GetPerm(this)).name + "+ to do that!"); return; } if (!File.Exists("extra/reported/" + msg2 + ".txt")) { Player.SendMessage(p, "The player you specified has not been reported!"); return; } var readtext = File.ReadAllText("extra/reported/" + msg2 + ".txt"); Player.SendMessage(p, readtext); return; } if (msg1.ToLower() == "delete") { if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this)) { Player.SendMessage(p, "You need to be a " + Group.findPermInt(CommandOtherPerms.GetPerm(this)).name + "+ to do that!"); return; } if (!File.Exists("extra/reported/" + msg2 + ".txt")) { Player.SendMessage(p, "The player you specified has not been reported!"); return; } if (!Directory.Exists("extra/reportedbackups")) { Directory.CreateDirectory("extra/reportedbackups"); } if (File.Exists("extra/reportedbackups/" + msg2 + ".txt")) { File.Delete("extra/reportedbackups/" + msg2 + ".txt"); } File.Move("extra/reported/" + msg2 + ".txt", "extra/reportedbackups/" + msg2 + ".txt"); Player.SendMessage(p, msg2 + "'s report has been deleted."); Server.s.Log(msg2 + "'s report has been deleted by " + p.name); return; } if (File.Exists("extra/reported/" + msg1 + ".txt")) { File.WriteAllText("extra/reported/" + msg1 + "(2).txt", msg2 + " - Reported by " + p.name + "." + " DateTime: " + DateTime.Now); Player.SendMessage(p, "Your report has been sent, it should be viewed when an operator is next online!"); return; } if (File.Exists("extra/reported/" + msg1 + "(2).txt")) { File.WriteAllText("extra/reported/" + msg1 + "(3).txt", msg2 + " - Reported by " + p.name + "." + " DateTime: " + DateTime.Now); Player.SendMessage(p, "Your report has been sent, it should be viewed when an operator is next online!"); return; } if (File.Exists("extra/reported/" + msg1 + "(3).txt")) { Player.SendMessage(p, "The player you have reported has already been reported 3 times! Please wait patiently or come back when an op is online!"); return; } File.WriteAllText("extra/reported/" + msg1 + ".txt", msg2 + " - Reported by " + p.name + "." + " DateTime: " + DateTime.Now); Player.SendMessage(p, "Your report has been sent, it should be viewed when an operator is next online!"); } }