public override void Use(Player p, string message) { if (p == null) { p.SendMessage("Command not usable in Console."); return; } Player who = Player.Find(p.summonRequest); if (p.summonRequest == "") { Player.SendMessage(p, "No summon requests have been recieved."); return; } if (who == null) { Player.SendMessage(p, "Player is no longer online!"); p.tpRequest = ""; return; } if (who == p) { Player.SendMessage(p, "Cannot accept summon request from yourself."); p.summonRequest = ""; return; } if (who.level.zombiegame == true && p.level != who.level) { Player.SendMessage(p, "They can't leave an Infection game!"); return; } if (p.level.zombiegame == true && p.level != who.level) { Player.SendMessage(p, "Infection is active on this map, they can't come here!"); return; } if (who.level.spleefstarted == true && p.level != who.level) { Player.SendMessage(p, "They can't leave a Spleef game!"); return; } if (p.level.spleefstarted == true && p.level != who.level) { Player.SendMessage(p, "Spleef is active on this map, they can't come here!"); return; } if (p.level != who.level) { if (who.level.name.Contains("cMuseum")) { Player.SendMessage(p, "Player \"" + who.name + "\" is in a museum!"); return; } else { Command.all.Find("goto").Use(p, who.level.name); while (p.Loading) { } unchecked { p.SendPos((byte)-1, who.pos[0], who.pos[1], who.pos[2], who.rot[0], 0); } //Command.all.Find("summon").Use(who, p.name); } } if (p.level == who.level) { if (who.Loading) { Player.SendMessage(p, "Waiting for " + who.color + who.name + Server.DefaultColor + " to spawn..."); while (who.Loading) { } } while (p.Loading) { } //Wait for player to spawn in new map unchecked { p.SendPos((byte)-1, who.pos[0], who.pos[1], who.pos[2], who.rot[0], 0); } } }
public override void Use(Player p, string message) { if (message != "") { Help(p); return; } ushort x = (ushort)((0.5 + p.level.spawnx) * 32); ushort y = (ushort)((1 + p.level.spawny) * 32); ushort z = (ushort)((0.5 + p.level.spawnz) * 32); unchecked { p.SendPos((byte)-1, x, y, z, p.level.rotx, p.level.roty); } }
public override void Use(Player p, string message) { if (message == "") { Command.all.Find("spawn"); return; } Player who = Player.Find(message); if (who == null || (who.hidden && p.group.Permission < LevelPermission.Admin)) { Player.SendMessage(p, "There is no player \"" + message + "\"!"); return; } if (p.group.Permission < LevelPermission.Operator && who.level.name != Server.HomePrefix + p.name.ToLower() && p.level.name != Server.HomePrefix + p.name.ToLower()) { if (p.level.locked || who.level.locked) { p.SendMessage("This map is currently locked!"); return; } } if (p.level.zombiegame == true && p.level != who.level) { Player.SendMessage(p, "You can't leave an Infection game!"); return; } if (who.level.zombiegame == true && p.level != who.level) { Player.SendMessage(p, "Infection is active on that map, you can't go to it!"); return; } if (p.level.spleefstarted == true && p.level != who.level) { Player.SendMessage(p, "You can't leave a Spleef game!"); return; } if (who.level.spleefstarted == true && p.level != who.level) { Player.SendMessage(p, "Spleef is active on that map, you can't go to it!"); return; } if (p.level != who.level) { if (Server.tpToHigher == false && who.group.Permission > p.group.Permission) { Player.SendMessage(p, "You can't teleport to someone of a higher rank!"); return; } if (who.level.name.Contains("cMuseum")) { Player.SendMessage(p, "Player \"" + message + "\" is in a museum!"); return; } else { Command.all.Find("goto").Use(p, who.level.name); while (p.Loading) { } unchecked { p.SendPos((byte)-1, who.pos[0], who.pos[1], who.pos[2], who.rot[0], 0); } Command.all.Find("tp").Use(p, who.name); } } if (p.level == who.level) { if (Server.tpToHigher == false && who.group.Permission > p.group.Permission) { Player.SendMessage(p, "You can't teleport to someone of a higher rank!"); } else { if (who.Loading) { Player.SendMessage(p, "Waiting for " + who.color + who.name + Server.DefaultColor + " to spawn..."); while (who.Loading) { } } while (p.Loading) { } //Wait for player to spawn in new map unchecked { p.SendPos((byte)-1, who.pos[0], who.pos[1], who.pos[2], who.rot[0], 0); } } } }
public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type) { p.ClearBlockchange(); byte b = p.level.GetTile(x, y, z); p.SendBlockchange(x, y, z, b); bool there = false; while (!there ) { y++; if (Block.Walkthrough(p.level.GetTile(x, y, z))) if (Block.Walkthrough(p.level.GetTile(x, (ushort)(y + 1), z))) if (!Block.Walkthrough(p.level.GetTile(x, (ushort)(y - 1), z))) { Player.SendMessage(p, "Teleported up."); unchecked { p.SendPos((byte)-1, (ushort)(x * 32), (ushort)((y + 1) * 32), (ushort)(z * 32), p.rot[0], p.rot[1]); } there = true; } } if (!there) { Player.SendMessage(p, "No free spaces available."); } if (p.staticCommands) { p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); } }
public override void Use(Player p, string message) { Player who = Player.Find(message); if (who.group.Permission > p.group.Permission) { Player.SendMessage(p, "Cannot rotate someone with equal or higher rank."); return; } if (!onGround(who)) { Player.SendMessage(p, "Player is not on ground! Cannot rotate!"); return; } Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " rotated " + who.color + who.name + Server.DefaultColor + "."); for (int i = 0; i < 8; i++) { if (who == null || !who.loggedIn) { Player.SendMessage(p, "Rotating stopped; player logged out during rotation"); return; } unchecked { p.SendPos((byte)-1, p.pos[0], p.pos[1], p.pos[2],(byte)(p.rot[0] * 20), p.rot[1]); } Thread.Sleep(10); } }
public override void Use(Player p, string message) { p.onTrain = !p.onTrain; if (!p.onTrain) return; Thread trainThread = new Thread(new ThreadStart(delegate { while (p.onTrain) { Thread.Sleep(3); ushort x = (ushort)(p.pos[0] / 32); ushort y = (ushort)(p.pos[1] / 32); ushort z = (ushort)(p.pos[2] / 32); for (ushort xx = (ushort)(x - 1); xx <= x + 1; xx++) { for (ushort yy = (ushort)(y - 1); yy <= y + 1; yy++) { for (ushort zz = (ushort)(z - 1); zz <= z + 1; zz++) { if (p.level.GetTile(xx, yy, zz) == Block.train) { p.invincible = true; p.trainGrab = true; byte newY = 0; if (y - yy == -1) newY = 240; else if (y - yy == 0) newY = 0; else newY = 8; unchecked { if (x - xx == -1) if (z - zz == -1) p.SendPos((byte)-1, (ushort)(xx * 32 + 16), (ushort)((yy + 1) * 32 - 2), (ushort)(zz * 32 + 16), (byte)96, newY); else if (z - zz == 0) p.SendPos((byte)-1, (ushort)(xx * 32 + 16), (ushort)((yy + 1) * 32 - 2), (ushort)(zz * 32 + 16), (byte)64, newY); else p.SendPos((byte)-1, (ushort)(xx * 32 + 16), (ushort)((yy + 1) * 32 - 2), (ushort)(zz * 32 + 16), (byte)32, newY); else if (x - xx == 0) if (z - zz == -1) p.SendPos((byte)-1, (ushort)(xx * 32 + 16), (ushort)((yy + 1) * 32 - 2), (ushort)(zz * 32 + 16), (byte)128, newY); else if (z - zz == 0) { } else p.SendPos((byte)-1, (ushort)(xx * 32 + 16), (ushort)((yy + 1) * 32 - 2), (ushort)(zz * 32 + 16), (byte)0, newY); else if (z - zz == -1) p.SendPos((byte)-1, (ushort)(xx * 32 + 16), (ushort)((yy + 1) * 32 - 2), (ushort)(zz * 32 + 16), (byte)160, newY); else if (z - zz == 0) p.SendPos((byte)-1, (ushort)(xx * 32 + 16), (ushort)((yy + 1) * 32 - 2), (ushort)(zz * 32 + 16), (byte)192, newY); else p.SendPos((byte)-1, (ushort)(xx * 32 + 16), (ushort)((yy + 1) * 32 - 2), (ushort)(zz * 32 + 16), (byte)224, newY); } goto skip; } } } } Thread.Sleep(3); p.invincible = false; p.trainGrab = false; skip: ; } Player.SendMessage(p, "Dismounted"); Thread.Sleep(1000); p.invincible = false; p.trainGrab = false; })); trainThread.Start(); Player.SendMessage(p, "Stand near a train to mount it"); }
public override void Use(Player p, string message) { if (p == null) { Player.SendMessage(p, "Command not usable in Console."); return; } try { int i = getDirection(p.rot[0]); ushort xx = (ushort)(p.pos[0] / 32), yy = (ushort)(p.pos[1] / 32), zz = (ushort)(p.pos[2] / 32); bool there = false; if (i == 0) { while (!there && xx < p.level.width) { xx++; if (Block.Walkthrough(p.level.GetTile(xx, yy, zz))) { if (Block.Walkthrough(p.level.GetTile((ushort)(xx + 1), yy, zz))) { if (!Block.Walkthrough(p.level.GetTile((ushort)(xx - 1), yy, zz))) { Player.SendMessage(p, "Passed through wall."); unchecked { p.SendPos((byte)-1, (ushort)((xx + 1) * 32), p.pos[1], p.pos[2], p.rot[0], p.rot[1]); } there = true; } } } } if (!there) { Player.SendMessage(p, "No free spaces available."); } } else if (i == 1) { while (!there && zz < p.level.depth) { zz++; if (Block.Walkthrough(p.level.GetTile(xx, yy, zz))) { if (Block.Walkthrough(p.level.GetTile(xx, yy, (ushort)(zz + 1)))) { if (!Block.Walkthrough(p.level.GetTile(xx, yy, (ushort)(zz - 1)))) { Player.SendMessage(p, "Passed through wall."); unchecked { p.SendPos((byte)-1, p.pos[0], p.pos[1], (ushort)((zz + 1) * 32), p.rot[0], p.rot[1]); } there = true; } } } } if (!there) { Player.SendMessage(p, "No free spaces available."); } } else if (i == 2) { while (!there && xx > 0) { xx--; if (Block.Walkthrough(p.level.GetTile(xx, yy, zz))) { if (Block.Walkthrough(p.level.GetTile((ushort)(xx - 1), yy, zz))) { if (!Block.Walkthrough(p.level.GetTile((ushort)(xx + 1), yy, zz))) { Player.SendMessage(p, "Passed through wall."); unchecked { p.SendPos((byte)-1, (ushort)((xx - 1) * 32), p.pos[1], p.pos[2], p.rot[0], p.rot[1]); } there = true; } } } } if (!there) { Player.SendMessage(p, "No free spaces available."); } } else if (i == 3) { while (!there && zz > 0) { zz--; if (Block.Walkthrough(p.level.GetTile(xx, yy, zz))) { if (Block.Walkthrough(p.level.GetTile(xx, yy, (ushort)(zz - 1)))) { if (!Block.Walkthrough(p.level.GetTile(xx, yy, (ushort)(zz + 1)))) { Player.SendMessage(p, "Passed through wall."); unchecked { p.SendPos((byte)-1, p.pos[0], p.pos[1], (ushort)((zz - 1) * 32), p.rot[0], p.rot[1]); } there = true; } } } } if (!there) { Player.SendMessage(p, "No free spaces available."); } } else { Player.SendMessage(p, "Could not pass through wall."); } } catch (Exception e) { Server.ErrorLog(e); Player.SendMessage(p, "Could not pass through wall."); } }
public override void Use(Player p, string message) { if (message == "") { Help(p); return; } try { Level foundLevel = Level.Find(message); if (foundLevel != null) { Level startLevel = p.level; GC.Collect(); if (p.activeCuboids > 0) { startLevel.unload = false; } if (p.group.Permission < LevelPermission.Operator && foundLevel.name != Server.HomePrefix + p.name.ToLower() && p.level.name != Server.HomePrefix + p.name.ToLower()) { if (foundLevel.locked == true && p.level != foundLevel) { Player.SendMessage(p, "This map is currently locked!"); return; } if (p.level.locked == true && p.level != foundLevel) { Player.SendMessage(p, "This map is currently locked!"); return; } } if (p.level.zombiegame == true && p.level != foundLevel) { Player.SendMessage(p, "You can't leave an Infection game!"); return; } if (foundLevel.zombiegame == true && p.level != foundLevel) { Player.SendMessage(p, "Infection is active on that map, you can't go to it!"); return; } if (p.level.spleefstarted == true && p.level != foundLevel) { Player.SendMessage(p, "You can't leave a Spleef game!"); return; } if (foundLevel.spleefstarted == true && p.level != foundLevel) { Player.SendMessage(p, "Spleef is active on that map, you can't go to it!"); return; } if (p.level == foundLevel) { Player.SendMessage(p, "You are already in \"" + foundLevel.name + "\"."); return; } if (!p.ignorePermission) if (p.group.Permission < foundLevel.permissionvisit) { Player.SendMessage(p, "You're not allowed to go to " + foundLevel.name + "."); return; } p.Loading = true; foreach (Player pl in Player.players) if (p.level == pl.level && p != pl) p.SendDie(pl.id); foreach (PlayerBot b in PlayerBot.playerbots) if (p.level == b.level) p.SendDie(b.id); Player.GlobalDie(p, true); p.level = foundLevel; p.SendUserMOTD(); p.SendMap(); GC.Collect(); ushort x = (ushort)((0.5 + foundLevel.spawnx) * 32); ushort y = (ushort)((1 + foundLevel.spawny) * 32); ushort z = (ushort)((0.5 + foundLevel.spawnz) * 32); if (!p.hidden) Player.GlobalSpawn(p, x, y, z, foundLevel.rotx, foundLevel.roty, true); else unchecked { p.SendPos((byte)-1, x, y, z, foundLevel.rotx, foundLevel.roty); } foreach (Player pl in Player.players) if (pl.level == p.level && p != pl && !pl.hidden) p.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 == p.level) p.SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]); if (!p.hidden) { Player.GlobalChat(p, p.color + p.name + Server.DefaultColor + " went to &b" + foundLevel.name, false); if (Server.womText) { Player.WomGlobalMessage(p.color + p.name + Server.DefaultColor + " went to &b" + foundLevel.name); } } p.Loading = false; bool skipUnload = false; if (startLevel.unload && !startLevel.name.Contains("&cMuseum ")) { foreach (Player pl in Player.players) if (pl.level == startLevel) skipUnload = true; if (!skipUnload && Server.AutoLoad) { if (p.hidden) { startLevel.Unload(true); } else { startLevel.Unload(); } } } } else if (Server.AutoLoad) { Command.all.Find("load").Use(p, message); foundLevel = Level.Find(message); if (foundLevel != null) Use(p, message); } else Player.SendMessage(p, "There is no level \"" + message + "\" loaded."); GC.Collect(); GC.WaitForPendingFinalizers(); } catch (Exception e) { Server.ErrorLog(e); } }
public override void Use(Player p, string message) { if (p == null) { Player.SendMessage(p, "Command not usable in Console."); return; } if (message.ToLower() != "now") { Player.SendMessage(p, "Click a block to go on top of."); p.ClearBlockchange(); p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); } else { ushort xx = (ushort)(p.pos[0] / 32), yy = (ushort)(p.pos[1] / 32), zz = (ushort)(p.pos[2] / 32); bool there = false; while (!there && yy < p.level.height) { yy++; if (Block.Walkthrough(p.level.GetTile(xx, yy, zz))) { if (Block.Walkthrough(p.level.GetTile(xx, (ushort)(yy + 1), zz))) { if (!Block.Walkthrough(p.level.GetTile(xx, (ushort)(yy - 1), zz))) { Player.SendMessage(p, "Teleported up."); unchecked { p.SendPos((byte)-1, p.pos[0], (ushort)((yy + 1) * 32), p.pos[2], p.rot[0], p.rot[1]); } there = true; } } } } if (!there) { Player.SendMessage(p, "No free spaces available."); } } }
//public static List<string> swearWords = new List<string>(); public static void Warn(Player p) { if (Server.swearWarnPlayer && p != null) p.swearWordsUsed++; if (p.swearWordsUsed >= Server.swearWordsRequired && p != null) if (Server.profanityFilterOp || (!Server.profanityFilterOp && p.group.Permission < LevelPermission.Operator)) switch (Server.profanityFilterStyle) { case "Kick": p.Kick("You were kicked for excessive use of swear words!"); return; case "TempBan": Command.all.Find("tempban").Use(null, p.name + " " + Server.antiSpamTempBanTime.ToString()); return; case "Mute": Command.all.Find("mute").Use(null, p.name); break; case "Slap": ushort currentX = (ushort)(p.pos[0] / 32); ushort currentY = (ushort)(p.pos[1] / 32); ushort currentZ = (ushort)(p.pos[2] / 32); ushort foundHeight = 0; for (ushort yy = currentY; yy <= 1000; yy++) { if (!Block.Walkthrough(p.level.GetTile(currentX, yy, currentZ)) && p.level.GetTile(currentX, yy, currentZ) != Block.Zero) { foundHeight = (ushort)(yy - 1); p.level.ChatLevel(p.color + p.name + "&g was slapped into the roof for excessive use of swear words!"); break; } } if (foundHeight == 0) { p.level.ChatLevel(p.color + p.name + "&g was slapped sky high for excessive use of swear words!"); foundHeight = 1000; } unchecked { p.SendPos((byte)-1, p.pos[0], (ushort)(foundHeight * 32), p.pos[2], p.rot[0], p.rot[1]); } break; default: goto case "Kick"; } if (Server.swearWarnPlayer && p != null) { Player.SendMessage(p, "&cYou have been warned for using a swear word!"); Player.GlobalMessageOps("To Ops: Warned " + p.color + p.name + "&g for using a swear word!"); Server.s.Log("Warned " + p.name + " for using a swear word!"); } }
public override void Use(Player p, string message) { if (p == null) { Player.SendMessage(p, "Command not usable from Console."); return; } if (!Directory.Exists("extra/waypoints")) Directory.CreateDirectory("extra/waypoints"); if (!File.Exists("extra/waypoints/" + p.name.ToLower() + ".txt")) File.Create("extra/waypoints/" + p.name.ToLower() + ".txt").Close(); var wpFile = new List<string>(File.ReadAllLines("extra/waypoints/" + p.name.ToLower() + ".txt")).Where(s => !String.IsNullOrEmpty(s)).Distinct().ToList(); var wpNames = new List<string>(); foreach (string s in wpFile) if (!String.IsNullOrEmpty(s.Split('|')[0])) wpNames.Add(s.Split('|')[0]); // Waypoint format: // one line per waypoint, stored in extra/waypoints/<name>.txt // name|level|x|y|z|rotx|roty switch (message.Split(' ')[0].ToLower()) { case "": case "list": if (wpFile.Count <= 0) { Player.SendMessage(p, "No waypoints saved yet."); Help(p); return; } Player.SendMessage(p, "Your waypoints:"); for (int i = 0; i < wpFile.Count; i++) { string[] wp = wpFile[i].Split('|'); Player.SendMessage(p, (i + 1) + ". &9" + wp[0] + "&g - &c" + wp[1] + "/" + wp[2] + "/" + wp[3] + "/" + wp[4]); } break; case "tp": case "teleport": case "go": case "goto": if (message.Split(' ').Length > 2 || message.Split(' ').Length <= 1) { Help(p); return; } if (wpFile.Count <= 0) { Player.SendMessage(p, "No waypoints saved yet."); Help(p); return; } if (!wpNames.Contains(message.Split(' ')[1].ToLower())) { Player.SendMessage(p, "Waypoint could not be found."); return; } string[] values = wpFile[wpNames.IndexOf(message.Split(' ')[1])].Split('|'); if (!File.Exists("levels/" + values[1] + ".lvl")) { Player.SendMessage(p, "Level does not exist."); return; } Level endLevel = Level.Find(values[1]); if (endLevel == null || p.level != endLevel) { if (!Server.AutoLoad) Command.all.Find("load").Use(p, values[1]); Command.all.Find("goto").Use(p, values[1]); } unchecked { p.SendPos((byte)-1, (ushort)(ushort.Parse(values[2]) * 32), (ushort)(ushort.Parse(values[3]) * 32), (ushort)(ushort.Parse(values[4]) * 32), byte.Parse(values[5]), byte.Parse(values[6])); } Player.SendMessage(p, "Sent you to waypoint: &9" + values[0] + "&g."); break; case "add": case "save": if (message.Split(' ').Length > 2 || message.Split(' ').Length <= 1) { Help(p); return; } bool existing = false; if (wpNames.Contains(message.Split(' ')[1].ToLower().Trim())) { existing = true; wpFile.RemoveAt(wpNames.IndexOf(message.Split(' ')[1].ToLower().Trim())); } var toAdd = new List<string>(); toAdd.Add(message.Split(' ')[1].ToLower().Trim().Replace("|", "")); toAdd.Add(p.level.name.ToLower()); toAdd.Add(((ushort)(p.pos[0] / 32)).ToString()); toAdd.Add(((ushort)(p.pos[1] / 32)).ToString()); toAdd.Add(((ushort)(p.pos[2] / 32)).ToString()); toAdd.Add(p.rot[0].ToString()); toAdd.Add(p.rot[1].ToString()); wpFile.Add(String.Join("|", toAdd.ToArray())); File.WriteAllLines("extra/waypoints/" + p.name.ToLower() + ".txt", wpFile.ToArray()); Player.SendMessage(p, "Waypoint &9" + message.Split(' ')[1].ToLower().Trim() + "&g " + (existing ? "saved" : "added") + "."); break; case "del": case "remove": if (message.Split(' ').Length > 2 || message.Split(' ').Length <= 1) { Help(p); return; } if (!wpNames.Contains(message.Split(' ')[1].ToLower())) { Player.SendMessage(p, "That waypoint does not exist."); return; } wpFile.RemoveAt(wpNames.IndexOf(message.Split(' ')[1].ToLower())); File.WriteAllLines("extra/waypoints/" + p.name.ToLower() + ".txt", wpFile.ToArray()); Player.SendMessage(p, "Waypoint deleted."); break; default: Help(p); return; } }
public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type) { try { byte by = p.level.GetTile(x, y, z); p.SendBlockchange(x, y, z, by); Pos bp = (Pos)p.blockchangeObject; double a = Math.Sin(((double)(128 - p.rot[0]) / 256) * 2 * Math.PI); double b = Math.Cos(((double)(128 - p.rot[0]) / 256) * 2 * Math.PI); double c = Math.Cos(((double)(p.rot[1] + 64) / 256) * 2 * Math.PI); double d = Math.Cos(((double)(p.rot[1]) / 256) * 2 * Math.PI); double bigDiag = Math.Sqrt(Math.Sqrt(p.level.width * p.level.width + p.level.height * p.level.height) + p.level.depth * p.level.depth + p.level.width * p.level.width); List<CatchPos> previous = new List<CatchPos>(); List<CatchPos> allBlocks = new List<CatchPos>(); CatchPos pos; if (p.modeType != Block.air) type = p.modeType; Thread gunThread = new Thread(new ThreadStart(delegate { try { ushort startX = (ushort)(p.pos[0] / 32); ushort startY = (ushort)(p.pos[1] / 32); ushort startZ = (ushort)(p.pos[2] / 32); pos.x = (ushort)Math.Round(startX + (double)(a * 3 * d)); pos.y = (ushort)Math.Round(startY + (double)(c * 3)); pos.z = (ushort)Math.Round(startZ + (double)(b * 3 * d)); for (double t = 4; bigDiag > t; t++) { pos.x = (ushort)Math.Round(startX + (double)(a * t * d)); pos.y = (ushort)Math.Round(startY + (double)(c * t)); pos.z = (ushort)Math.Round(startZ + (double)(b * t * d)); by = p.level.GetTile(pos.x, pos.y, pos.z); if (by != Block.air && !allBlocks.Contains(pos)) { if (p.level.physics < 2 || bp.ending <= 0) { break; } else { if (bp.ending == 1) { if ((!Block.LavaKill(by) && !Block.NeedRestart(by)) && by != Block.glass) { break; } } else if (p.level.physics >= 3 && p.level.physics != 5) { if (by != Block.glass) { p.level.MakeExplosion(pos.x, pos.y, pos.z, 1); break; } } else { break; } } } p.level.Blockchange(pos.x, pos.y, pos.z, type); previous.Add(pos); allBlocks.Add(pos); bool comeOut = false; foreach (Player pl in Player.players) { if (pl.level == p.level) { if ((ushort)(pl.pos[0] / 32) == pos.x || (ushort)(pl.pos[0] / 32 + 1) == pos.x || (ushort)(pl.pos[0] / 32 - 1) == pos.x) { if ((ushort)(pl.pos[1] / 32) == pos.y || (ushort)(pl.pos[1] / 32 + 1) == pos.y || (ushort)(pl.pos[1] / 32 - 1) == pos.y) { if ((ushort)(pl.pos[2] / 32) == pos.z || (ushort)(pl.pos[2] / 32 + 1) == pos.z || (ushort)(pl.pos[2] / 32 - 1) == pos.z) { if (p.level.ctfmode && !p.level.ctfgame.friendlyfire && p.team == pl.team) { comeOut = true; break; } if (p.level.ctfmode) { pl.health = pl.health - 25; if (pl.health > 0) { pl.SendMessage("You have been shot! You have &c" + pl.health + Server.DefaultColor + " health remaining."); comeOut = true; break; } } if ((p.level.physics >= 3 && pl.level.physics != 5) && (bp.ending == 2 || bp.ending == 3)) { pl.HandleDeath(Block.stone, " was blown up by " + p.color + p.name, true); } else if (bp.ending == 4) { Player.GlobalChat(null, pl.color + pl.name + "&g was shot by the freezegun.", false); Command.all.Find("freeze").Use(p, pl.name); } else if (bp.ending == 5) { Player.GlobalChat(null, pl.color + pl.name + "&g was shot by the cagegun.", false); Command.all.Find("cage").Use(p, pl.name); } else if (bp.ending == 6) { Player.GlobalChat(null, pl.color + pl.name + "&g was shot by the botgun.", false); Command.all.Find("botadd").Use(pl, p.name); } else if (bp.ending == 7) { Player.GlobalChat(null, pl.color + pl.name + "&g was shot by the maingun.", false); Command.all.Find("main").Use(pl, ""); } else if (bp.ending == 8) { Player.GlobalChat(null, pl.color + pl.name + "&g was shot by the demotegun.", false); Command.all.Find("demote").Use(p, pl.name); } else if (bp.ending == 9) { Player.GlobalChat(null, pl.color + pl.name + "&g was shot by the promotegun.", false); Command.all.Find("promote").Use(p, pl.name); } else if (bp.ending == 10) { Player.GlobalChat(null, pl.color + pl.name + "&g was shot by the jokergun.", false); Command.all.Find("joker").Use(p, pl.name); } else if (bp.ending == 11) { try { Player.GlobalChat(null, pl.color + pl.name + "&g was shot by the kickgun.", false); Command.all.Find("kick").Use(p, pl.name); break; } catch { } } else if (bp.ending == 12) { Player.GlobalChat(null, pl.color + pl.name + "&g was shot by the undogun.", false); Command.all.Find("undo").Use(pl, ""); } else if (bp.ending == 13) { Player.GlobalChat(null, pl.color + pl.name + "&g was shot by the redogun.", false); Command.all.Find("redo").Use(pl, ""); } else if (bp.ending == 14) { try { Player.GlobalChat(null, pl.color + pl.name + "&g was shot by the xbangun.", false); Command.all.Find("xban").Use(p, pl.name); break; } catch { } } else if (bp.ending == 15) { Player.GlobalChat(null, pl.color + pl.name + "&g was shot by the rulesgun.", false); Command.all.Find("rules").Use(p, pl.name); } else { pl.HandleDeath(Block.stone, " was shot by " + p.color + p.name); } comeOut = true; // freeze, cage, bot, main, demote, promote, joker, kick, undo, redo, xban, rules"); } } } } } if (comeOut) break; if (t > 12 && bp.ending != 3) { pos = previous[0]; p.level.Blockchange(pos.x, pos.y, pos.z, Block.air); previous.Remove(pos); } if (bp.ending != 3) Thread.Sleep(20); } if (bp.ending == -1) try { unchecked { p.SendPos((byte)-1, (ushort)(previous[previous.Count - 3].x * 32), (ushort)(previous[previous.Count - 3].y * 32 + 32), (ushort)(previous[previous.Count - 3].z * 32), p.rot[0], p.rot[1]); } } catch { } if (bp.ending == 3) Thread.Sleep(400); foreach (CatchPos pos1 in previous) { p.level.Blockchange(pos1.x, pos1.y, pos1.z, Block.air); if (bp.ending != 3) Thread.Sleep(20); } } catch (Exception e) { Server.ErrorLog(e); } })); gunThread.Start(); } catch { } }
public override void Use(Player p, string message) { if (message == "") message = "list"; string[] parameters = message.Split(' '); if (parameters[0].ToLower() == "list") { if (parameters.Length > 1) { int pageNum, currentNum; try { pageNum = int.Parse(parameters[1]) * 10; currentNum = pageNum - 10; } catch { Help(p); return; } if (currentNum < 0) { Player.SendMessage(p, "Must be greater than 0"); return; } if (pageNum > p.level.ZoneList.Count) pageNum = p.level.ZoneList.Count; if (currentNum > p.level.ZoneList.Count) { Player.SendMessage(p, "No Zones beyond number " + (p.level.ZoneList.Count - 1)); return; } Player.SendMessage(p, "Zones (" + currentNum + " to " + (pageNum - 1) + "):"); for (int i = currentNum; i < pageNum; i++) { Level.Zone zone = p.level.ZoneList[i]; Player.SendMessage(p, "&c" + i + " &b(" + zone.smallX + "-" + zone.bigX + ", " + zone.smallY + "-" + zone.bigY + ", " + zone.smallZ + "-" + zone.bigZ + ") &f" + zone.Owner); } } else { for (int i = 0; i < p.level.ZoneList.Count; i++) { Level.Zone zone = p.level.ZoneList[i]; Player.SendMessage(p, "&c" + i + " &b(" + zone.smallX + "-" + zone.bigX + ", " + zone.smallY + "-" + zone.bigY + ", " + zone.smallZ + "-" + zone.bigZ + ") &f" + zone.Owner); } Player.SendMessage(p, "For a more structured list, use /tpzone list <1/2/3/..>"); } } else { int zoneID; try { zoneID = int.Parse(message); } catch { Help(p); return; } if (zoneID < 0 || zoneID > p.level.ZoneList.Count) { Player.SendMessage(p, "This zone doesn't exist"); return; } Level.Zone zone = p.level.ZoneList[zoneID]; unchecked { p.SendPos((byte)-1, (ushort)(zone.bigX * 32 + 16), (ushort)(zone.bigY * 32 + 32), (ushort)(zone.bigZ * 32 + 16), p.rot[0], p.rot[1]); } Player.SendMessage(p, "Teleported to zone &c" + zoneID + " &b(" + zone.bigX + ", " + zone.bigY + ", " + zone.bigZ + ") &f" + zone.Owner); } }