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 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 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."); return; }
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) { 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!"); } }
public override void Use(Player p, string message) { if (p == null) { Server.s.Log("'null' or console tried to use '/chatroom', This command is limited to ingame, sorry!!"); return; } string[] command = message.ToLower().Split(' '); string par0 = String.Empty; string par1 = String.Empty; string par2 = String.Empty; string par3 = String.Empty; try { par0 = command[0]; par1 = command[1]; par2 = command[2]; par3 = command[3]; } catch { } if (message == null || par0 == null || message.Trim() == "" || par0.Trim() == "") { if (Server.Chatrooms.Count == 0) { Player.SendMessage(p, "There are currently no rooms"); return; } else { Player.SendMessage(p, "The current rooms are:"); foreach (string room in Server.Chatrooms) { Player.SendMessage(p, room); } return; } } else if (par0 == "join") { if (Server.Chatrooms.Contains(par1)) { if (p.spyChatRooms.Contains(par1)) { Player.SendMessage(p, "The chat room '" + par1 + "' has been removed from your spying list because you are joining the room."); p.spyChatRooms.Remove(par1); } Player.SendMessage(p, "You've joined the chat room '" + par1 + "'"); Player.ChatRoom(p, p.color + p.name + Server.DefaultColor + " has joined your chat room", false, par1); p.Chatroom = par1; return; } else { Player.SendMessage(p, "Sorry, '" + par1 + "' is not a chat room"); return; } } else if (par0 == "leave") { Player.SendMessage(p, "You've left the chat room '" + p.Chatroom + "'"); Player.ChatRoom(p, p.color + p.name + Server.DefaultColor + " has left the chat room", false, p.Chatroom); Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " has left their chat room " + p.Chatroom); p.Chatroom = null; return; } else if (par0 == "create" || par0 == "make") { if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 1)) { if (Server.Chatrooms.Contains(par1)) { Player.SendMessage(p, "Sorry, '" + par1 + "' already exists"); return; } else { Server.Chatrooms.Add(par1); Player.GlobalMessage("The chat room '" + par1 + "' has been created"); return; } } else { Player.SendMessage(p, "Sorry, You aren't a high enough rank to do that"); return; } } else if (par0 == "delete" || par0 == "remove") { if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 3)) { if (Server.Chatrooms.Contains(par1)) { Player.GlobalMessage(par1 + " is being deleted"); if (p.Chatroom == par1) { Command.all.Find("chatroom").Use(p, "leave"); } Server.Chatrooms.Remove(par1); foreach (Player pl in Player.players) { if (pl.Chatroom == par1) { pl.Chatroom = null; Player.SendMessage(pl, "You've left the room '" + par1 + "' because it is being deleted"); } if (pl.spyChatRooms.Contains(par1)) { pl.spyChatRooms.Remove(par1); pl.SendMessage("Stopped spying on chat room '" + par1 + "' because it is being deleted by: " + p.color + p.name); } } Player.GlobalMessage("The chatroom '" + par1 + "' has been " + (par0 + "d")); Player.SendMessage(p, (par0 + "d ") + " room '" + par1 + "'"); return; } else { Player.SendMessage(p, "Sorry, '" + par1 + "' doesn't exist"); return; } } if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 2)) { if (Server.Chatrooms.Contains(par1)) { foreach (Player pl in Player.players) { if (pl != p) { if (pl.Chatroom == par1) { Player.SendMessage(p, "Sorry, someone else is in the room"); return; } } } if (p.Chatroom == par1) { Command.all.Find("chatroom").Use(p, "leave"); } Server.Chatrooms.Remove(par1); foreach (Player pl in Player.players) { if (pl.spyChatRooms.Contains(par1)) { pl.spyChatRooms.Remove(par1); pl.SendMessage("Stopped spying on chat room '" + par1 + "' because it is being deleted by: " + p.color + p.name); } } Player.SendMessage(p, (par0 + "d ") + " room '" + par1 + "'"); } else { Player.SendMessage(p, "Sorry, '" + par1 + "' doesn't exist"); return; } } else { Player.SendMessage(p, "Sorry, You aren't a high enough rank to do that"); return; } } else if (par0 == "spy") { if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 4)) { if (Server.Chatrooms.Contains(par1)) { if (p.Chatroom != par1) { if (p.spyChatRooms.Contains(par1)) { Player.SendMessage(p, "'" + par1 + "' is already on your spying list!!"); return; } else { p.spyChatRooms.Add(par1); Player.SendMessage(p, "'" + par1 + "' has been added to your chat room spying list"); return; } } else { Player.SendMessage(p, "Sorry, you can't spy on your own room"); return; } } else { Player.SendMessage(p, "Sorry, '" + par1 + "' isn't a room"); return; } } else { Player.SendMessage(p, "Sorry, '" + par0 + "' Wasn't a correct command addition and it wasn't a room. Sorry"); return; } } else if (par0 == "forcejoin") //[player] [room] { if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 5)) { Player pl = Player.Find(par1); if (pl == null) { Player.SendMessage(p, "Sorry, '" + par1 + "' isn't a player"); return; } if (!Server.Chatrooms.Contains(par2)) { Player.SendMessage(p, "Sorry, '" + par2 + " isn't a room"); return; } if (pl.group.Permission >= p.group.Permission) { Player.SendMessage(p, "Sorry, You can't do that to someone of higher or equal rank"); return; } else { if (Server.Chatrooms.Contains(par2)) { if (pl.spyChatRooms.Contains(par2)) { Player.SendMessage(pl, "The chat room '" + par2 + "' has been removed from your spying list because you are force joining the room '" + par2 + "'"); pl.spyChatRooms.Remove(par2); } Player.SendMessage(pl, "You've been forced to join the chat room '" + par2 + "'"); Player.ChatRoom(pl, pl.color + pl.name + Server.DefaultColor + " has force joined your chat room", false, par2); pl.Chatroom = par2; Player.SendMessage(p, pl.color + pl.name + Server.DefaultColor + " has been forced to join the chatroom '" + par2 + "' by you"); return; } } } else { Player.SendMessage(p, "Sorry, You aren't a high enough rank to do that"); return; } } else if (par0 == "kick" || par0 == "forceleave") { if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 6)) { Player pl = Player.Find(par1); if (pl == null) { Player.SendMessage(p, "Sorry, '" + par1 + "' isn't a player"); return; } if (pl.group.Permission >= p.group.Permission) { Player.SendMessage(p, "Sorry, You can't do that to someone of higher or equal rank"); return; } else { Player.SendMessage(pl, "You've been kicked from the chat room '" + pl.Chatroom + "'"); Player.SendMessage(p, pl.color + pl.name + Server.DefaultColor + " has been kicked from the chat room '" + pl.Chatroom + "'"); Player.ChatRoom(pl, pl.color + pl.name + Server.DefaultColor + " has been kicked from your chat room", false, pl.Chatroom); pl.Chatroom = null; } } else { Player.SendMessage(p, "Sorry, You aren't a high enough rank to do that"); return; } } else if (par0 == "globalmessage" || par0 == "global" || par0 == "all") { string globalmessage = message.Replace(par0 + " ", ""); if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 7)) { Player.GlobalChatRoom(p, globalmessage, true); return; } else { if (p.lastchatroomglobal.AddSeconds(30) < DateTime.Now) { Player.GlobalChatRoom(p, globalmessage, true); p.lastchatroomglobal = DateTime.Now; return; } else { Player.SendMessage(p, "Sorry, You must wait 30 seconds inbetween each global chatroom message!!"); return; } } } else if (par0 == "help") { Help(p); return; } else if (Server.Chatrooms.Contains(par0)) { Player.SendMessage(p, "Players in '" + par0 + "' :"); foreach (Player pl in Player.players) { if (pl.Chatroom == par0) { Player.SendMessage(p, pl.color + pl.name); } } return; } else { Player.SendMessage(p, "Sorry, '" + par0 + "' Wasn't a correct command addition and it wasn't a room. Sorry"); Help(p); return; } }
public override void Use(Player p, string message) { if (message == "") { Help(p); return; } Player pl = Player.Find(message); if (pl != null && !pl.hidden) { Player.SendMessage(p, pl.color + pl.name + Server.DefaultColor + " is online, using /whois instead."); Command.all.Find("whois").Use(p, message); return; } if (message.IndexOf("'") != -1) { Player.SendMessage(p, "Cannot parse request."); return; } string FoundRank = Group.findPlayer(message.ToLower()); DataTable playerDb = Server.useMySQL ? MySQL.fillData("SELECT * FROM Players WHERE Name='" + message + "'") : SQLite.fillData("SELECT * FROM Players WHERE Name='" + message + "'"); if (playerDb.Rows.Count == 0) { Player.SendMessage(p, Group.Find(FoundRank).color + message + Server.DefaultColor + " has the rank of " + Group.Find(FoundRank).color + FoundRank); return; } Player.SendMessage(p, Group.Find(FoundRank).color + playerDb.Rows[0]["Title"] + " " + message + Server.DefaultColor + " has :"); Player.SendMessage(p, "> > the rank of " + Group.Find(FoundRank).color + FoundRank); try { if (!Group.Find("Nobody").commands.Contains("pay") && !Group.Find("Nobody").commands.Contains("give") && !Group.Find("Nobody").commands.Contains("take")) { Player.SendMessage(p, "> > &a" + playerDb.Rows[0]["Money"] + Server.DefaultColor + " " + Server.moneys); } } catch { } Player.SendMessage(p, "> > &cdied &a" + playerDb.Rows[0]["TotalDeaths"] + Server.DefaultColor + " times"); Player.SendMessage(p, "> > &bmodified &a" + playerDb.Rows[0]["totalBlocks"] + " &eblocks."); Player.SendMessage(p, "> > was last seen on &a" + playerDb.Rows[0]["LastLogin"]); Player.SendMessage(p, "> > " + TotalTime(playerDb.Rows[0]["TimeSpent"].ToString())); Player.SendMessage(p, "> > first logged into the server on &a" + playerDb.Rows[0]["FirstLogin"]); Player.SendMessage(p, "> > logged in &a" + playerDb.Rows[0]["totalLogin"] + Server.DefaultColor + " times, &c" + playerDb.Rows[0]["totalKicked"] + Server.DefaultColor + " of which ended in a kick."); Player.SendMessage(p, "> > " + Awards.awardAmount(message) + " awards"); bool skip = false; if (p != null) { if ((int)p.group.Permission <= CommandOtherPerms.GetPerm(this)) { skip = true; } } if (!skip) { if (Server.bannedIP.Contains(playerDb.Rows[0]["IP"].ToString())) { playerDb.Rows[0]["IP"] = "&8" + playerDb.Rows[0]["IP"] + ", which is banned"; } Player.SendMessage(p, "> > the IP of " + playerDb.Rows[0]["IP"]); if (Server.useWhitelist) { if (Server.whiteList.Contains(message.ToLower())) { Player.SendMessage(p, "> > Player is &fWhitelisted"); } } if (Server.devs.Contains(message.ToLower())) { Player.SendMessage(p, Server.DefaultColor + "> > Player is a &9Developer"); } } playerDb.Dispose(); }
public override void Use(Player p, string message) { if (message == "") { message = p.name; } if (message.ToLower() == "all") { if ((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 == p.level) { 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.hidden) { who.SendMessage("&bMap reloaded by " + p.name); } if (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(message); 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."); */ } }