public static void Run(SvPlayer player, string message) { string arg1 = GetArgument.Run(1, false, true, message); if (string.IsNullOrEmpty(arg1)) { player.SendChatMessage(ArgRequired); return; } var shPlayer = GetShByStr.Run(arg1); if (shPlayer == null) { player.SendChatMessage(NotFoundOnline); return; } if (shPlayer == player.player) { player.SendChatMessage($"<color={errorColor}>You cannot teleport to yourself.</color>"); return; } PlayerList[shPlayer.ID].TpaUser = player.player; player.SendChatMessage($"<color={infoColor}>Sent a TPA request to</color> <color={argColor}>{shPlayer.username}</color><color={infoColor}>.</color>"); shPlayer.svPlayer.SendChatMessage($"<color={argColor}>{player.player.username}</color> <color={infoColor}>sent you a tpa request. Type</color> <color={argColor}>{CmdCommandCharacter}{CmdTpaaccept}</color> <color={infoColor}>to accept it.</color>"); }
public static void Run(SvPlayer player, string message) { string arg = GetArgument.Run(1, false, false, message).Trim().ToLower(); switch (arg) { case "ver": case "version": player.SendChatMessage("Version: " + Variables.Version); break; case "help": player.SendChatMessage("Subcommands for /essentials:"); player.SendChatMessage(" - help : Shows this menu."); player.SendChatMessage(" - info : Shows infomation about the developer."); player.SendChatMessage(" - ver/version : Shows version number."); player.SendChatMessage(" - cmd/command : Gives a link to the website of BP-Essentials."); break; case "cmd": case "cmds": case "command": case "commands": player.SendChatMessage("Up to date help can be found at https://goo.gl/Rwhtjs"); break; case "info": default: player.SendChatMessage("Essentials Created by UserR00T & DeathByKorea & BP."); player.SendChatMessage("Version " + Variables.Version); player.SendChatMessage("Type '/essentials help' for more info. "); break; } }
public static void Run(SvPlayer player, string message) { string arg1 = GetArgument.Run(1, false, true, message); if (string.IsNullOrEmpty(arg1)) { player.SendChatMessage(ArgRequired); return; } if (WipePassword == "default") { player.SendChatMessage($"<color={errorColor}>Password was not changed yet, cannot use this command.</color>"); return; } if (arg1 != WipePassword) { player.SendChatMessage($"<color={errorColor}>Invalid password.</color>"); return; } Debug.Log($"{PlaceholderParser.ParseTimeStamp()} [INFO] Wipe command ran by {player.player.username}, password matched, deleting all save files."); foreach (var currPlayer in PlayerList.Values.ToList()) { player.svManager.Disconnect(currPlayer.ShPlayer.svPlayer.connection, DisconnectTypes.Problem); } Thread.Sleep(500); var files = Directory.GetFiles(Path.Combine(Application.persistentDataPath, "PlayerData/"), "*.json").Where(item => item.EndsWith(".json", StringComparison.CurrentCulture)); foreach (var file in files.ToList()) { File.Delete(file); } Debug.Log($"{PlaceholderParser.ParseTimeStamp()} [INFO] All user data deleted!"); }
public static void Run(SvPlayer player, string message) { string arg1 = GetArgument.Run(1, false, true, message); if (string.IsNullOrEmpty(arg1)) { player.SendChatMessage(ArgRequired); return; } var currPlayer = GetShByStr.Run(arg1); if (currPlayer == null) { player.SendChatMessage(NotFoundOnline); return; } currPlayer.svPlayer.Restrain(currPlayer.manager.handcuffed); var shRetained = currPlayer.curEquipable as ShRestrained; currPlayer.svPlayer.SvSetEquipable(shRetained.otherRestrained.index); if (!currPlayer.svPlayer.serverside) { currPlayer.svPlayer.SendChatMessage("You've been restrained"); } player.SendChatMessage($"<color={infoColor}>Restrained</color> <color={argColor}>{currPlayer.username}</color><color={infoColor}>.</color>"); }
public static void Run(SvPlayer player, string message) { string arg1 = GetArgument.Run(1, false, true, message); if (string.IsNullOrEmpty(arg1)) { player.SendChatMessage(ArgRequired); return; } var currPlayer = GetShByStr.Run(arg1); if (currPlayer == null) { player.SendChatMessage(NotFoundOnline); return; } ReadFile.Run(MuteListFile); if (!MutePlayers.Contains(currPlayer.username)) { MutePlayers.Add(currPlayer.username); File.AppendAllText(MuteListFile, currPlayer.username + Environment.NewLine); player.SendChatMessage($"<color={infoColor}>Muted </color><color={argColor}>{currPlayer.username}</color><color={infoColor}>.</color>"); return; } RemoveStringFromFile.Run(MuteListFile, currPlayer.username); ReadFile.Run(MuteListFile); player.SendChatMessage($"<color={infoColor}>Unmuted </color><color={argColor}>{currPlayer.username}</color><color={infoColor}>.</color>"); }
public static void Run(SvPlayer player, string message) { string arg1 = GetArgument.Run(1, false, true, message); string arg2 = message.Split(' ').Last().Trim(); string correctSyntax = $"<color={argColor}>{GetArgument.Run(0, false, false, message)}</color> <color={errorColor}>[Player] [Amount]</color> <color={warningColor}>(Incorrect or missing argument(s).)</color>"; if (string.IsNullOrEmpty(arg1) || string.IsNullOrEmpty(arg2)) { player.SendChatMessage(correctSyntax); return; } int lastIndex = arg1.LastIndexOf(" ", StringComparison.CurrentCulture); if (lastIndex != -1) arg1 = arg1.Remove(lastIndex).Trim(); bool parsedSuccessfully = int.TryParse(arg2, out var arg2int); if (!parsedSuccessfully) { player.SendChatMessage(correctSyntax); return; } var currPlayer = GetShByStr.Run(arg1); if (currPlayer == null) { player.SendChatMessage(NotFoundOnline); return; } currPlayer.TransferMoney(DeltaInv.AddToMe, arg2int, true); player.SendChatMessage($"<color={infoColor}>Successfully gave</color> <color={argColor}>{currPlayer.username} {arg2int}</color><color={infoColor}>$</color>"); currPlayer.svPlayer.SendChatMessage($"<color={argColor}>{player.player.username}</color><color={infoColor}> gave you </color><color={argColor}>{arg2int}</color><color={infoColor}>$!</color>"); }
public static void Run(SvPlayer player, string message) { string arg1 = GetArgument.Run(1, false, true, message); if (string.IsNullOrEmpty(arg1)) { arg1 = player.player.username; } var currPlayer = GetShByStr.Run(arg1); if (currPlayer == null) { player.SendChatMessage(NotFoundOnline); return; } ReadFile.Run(GodListFile); var msg = $"<color={infoColor}>Godmode</color> <color={argColor}>{{0}}</color> <color={infoColor}>for</color> <color={argColor}>'{arg1}'</color><color={infoColor}>.</color>"; if (GodListPlayers.Contains(currPlayer.username)) { RemoveStringFromFile.Run(GodListFile, currPlayer.username); ReadFile.Run(GodListFile); player.SendChatMessage(string.Format(msg, "disabled")); return; } File.AppendAllText(GodListFile, currPlayer.username + Environment.NewLine); GodListPlayers.Add(currPlayer.username); player.SendChatMessage(string.Format(msg, "enabled")); }
public static void Run(SvPlayer player, string message) { string arg1 = GetArgument.Run(1, false, true, message); if (string.IsNullOrEmpty(arg1)) { player.SendChatMessage(ArgRequired); return; } var currPlayer = GetShByStr.Run(arg1); if (currPlayer == null) { player.SendChatMessage(NotFoundOnline); return; } // To be improved currPlayer.svPlayer.SvSetWearable(-1626497894); //NullArmor currPlayer.svPlayer.SvSetWearable(673780802); //NullBack currPlayer.svPlayer.SvSetWearable(-1638932793); //NullBody currPlayer.svPlayer.SvSetWearable(1089711634); //NullFace currPlayer.svPlayer.SvSetWearable(2064679354); //NullFeet currPlayer.svPlayer.SvSetWearable(1174688158); //NullHands currPlayer.svPlayer.SvSetWearable(-501996567); //NullHead currPlayer.svPlayer.SvSetWearable(-1191209217); //NullLegs foreach (var item in currPlayer.myItems.Values.ToList()) { if (item.item.GetType() == typeof(ShWearable)) { currPlayer.TransferItem(DeltaInv.RemoveFromMe, item.item.index, currPlayer.MyItemCount(item.item.index), true); } } currPlayer.svPlayer.SendChatMessage($"<color={argColor}>{player.playerData.username}</color> <color={warningColor}>Removed your clothes.</color>"); player.SendChatMessage($"<color={infoColor}>Removed </color><color={argColor}>{currPlayer.username}</color><color={infoColor}>'s clothes.</color>"); }
public static void Run(SvPlayer player, string message) { string arg1 = GetArgument.Run(1, false, true, message); if (string.IsNullOrEmpty(arg1)) { player.SendChatMessage(ArgRequired); return; } var shPlayer = GetShByStr.Run(arg1); if (shPlayer == null) { player.SendChatMessage(NotFoundOnline); return; } var tempList = new List <InventoryItem>(); foreach (var item in shPlayer.myItems.Values) { tempList.Add(item); } for (int i = 0; i < tempList.Count; i++) { shPlayer.TransferItem(DeltaInv.RemoveFromMe, tempList[i].item.index, shPlayer.MyItemCount(tempList[i].item.index), true); } player.SendChatMessage($"<color={infoColor}>You cleared the inventory of</color> <color={argColor}>{shPlayer.username}</color><color={infoColor}>.</color>"); shPlayer.svPlayer.SendChatMessage($"<color={warningColor}>Your inventory has been cleared by</color> <color={argColor}>{player.playerData.username}</color><color={warningColor}>.</color>"); }
public static void Run(SvPlayer player, string message) { string arg1 = GetArgument.Run(1, false, true, message); if (string.IsNullOrEmpty(arg1)) { player.SendChatMessage(ArgRequired); return; } arg1 = arg1.Remove(arg1.LastIndexOf(" ", StringComparison.CurrentCulture)).Trim(); var shPlayer = GetShByStr.Run(arg1); if (shPlayer == null) { player.SendChatMessage(NotFoundOnline); return; } if (!float.TryParse(message.Split(' ').Last().Trim(), out float time)) { player.SendChatMessage(ArgRequired); return; } if (!SendToJail.Run(shPlayer, time)) { player.SendChatMessage($"<color={errorColor}>Cannot send</color> <color={argColor}>{shPlayer.username}</color> <color={errorColor}>To jail.</color>"); return; } shPlayer.svPlayer.SendChatMessage($"<color={argColor}>{player.player.username}</color> <color={infoColor}>sent you to jail.</color>"); player.SendChatMessage($"<color={infoColor}>Sent</color> <color={argColor}>{shPlayer.username}</color> <color={infoColor}>To jail.</color>"); }
public static void Run(SvPlayer player, string message) { string arg1 = GetArgument.Run(1, false, false, message); if (arg1 == "all" || arg1 == "everyone") { if (!player.player.admin) { player.SendChatMessage(MsgNoPerm); return; } for (var i = 0; i < 6; i++) { player.SendChatMessage(" "); } player.SendChatMessage($"<color={argColor}>{player.playerData.username}</color><color={warningColor}> Cleared the chat for everyone.</color>"); } else { for (var i = 0; i < 6; i++) { player.SendChatMessage(" "); } player.SendChatMessage($"<color={warningColor}>Cleared the chat for yourself.</color>"); } }
public static void Run(SvPlayer player, string message) { var arg1 = GetArgument.Run(1, false, true, message); if (string.IsNullOrEmpty(arg1)) { player.Send(SvSendType.Self, Channel.Reliable, ClPacket.GameMessage, ArgRequired); return; } var currPlayer = GetShByStr.Run(arg1); if (currPlayer == null) { player.SendChatMessage(NotFoundOnline); return; } string[] contentarray = { "Username: "******"", "", "Job: " + Jobs[currPlayer.job.jobIndex], "Health: " + Math.Floor(currPlayer.health), "OwnsApartment: " + (bool)currPlayer.ownedApartment, "Position: " + currPlayer.GetPosition().ToString(), "WantedLevel: " + currPlayer.wantedLevel, "IsAdmin: " + currPlayer.admin, "BankBalance: " + currPlayer.svPlayer.bankBalance, "ChatEnabled: " + PlayerList[currPlayer.ID].ChatEnabled, "IP: " + currPlayer.svPlayer.connection.IP }; var content = string.Join("\r\n", contentarray); player.Send(SvSendType.Self, Channel.Reliable, ClPacket.ServerInfo, content); }
public static void Run(SvPlayer player, string message) { string arg1 = GetArgument.Run(1, false, false, message); string arg2 = GetArgument.Run(2, false, false, message); if (string.IsNullOrEmpty(arg1)) { player.SendChatMessage(ArgRequired); return; } if (string.IsNullOrWhiteSpace(arg2)) { arg2 = "1"; } bool parsedSuccessfully = int.TryParse(arg1, out int arg1int); parsedSuccessfully = int.TryParse(arg2, out int arg2int); if (!parsedSuccessfully) { player.SendChatMessage(NotValidArg); return; } if (arg1int < 0 || arg1int > IDs_Items.Length) { player.SendChatMessage($"<color={errorColor}>Error: The ID must be between 1 and {IDs_Items.Length}.</color>"); return; } player.player.TransferItem(DeltaInv.AddToMe, IDs_Items[arg1int - 1], arg2int, true); player.SendChatMessage($"<color={infoColor}>Giving you item ID: </color><color={argColor}>{arg1}</color>"); }
public static void Run(SvPlayer player, string message) { var arg1 = GetArgument.Run(1, false, true, message); if (string.IsNullOrWhiteSpace(arg1)) { player.SendChatMessage(ArgRequired); return; } player.Send(LocalChatMe ? SvSendType.Local : SvSendType.All, Channel.Unsequenced, ClPacket.GameMessage, PlaceholderParser.ParseUserMessage(player.player, MeMessage, arg1)); }
public static void Run(SvPlayer player, string message) { string arg1 = GetArgument.Run(1, false, true, message); if (string.IsNullOrEmpty(arg1)) { player.SendChatMessage(ArgRequired); return; } player.Send(SvSendType.All, Channel.Unsequenced, ClPacket.GameMessage, arg1 + " disconnected"); }
public static void Run(SvPlayer player, string message) { string arg1 = GetArgument.Run(1, false, true, message); if (string.IsNullOrEmpty(arg1)) { player.SendChatMessage(ArgRequired); return; } player.Send(SvSendType.All, Channel.Unsequenced, ClPacket.GameMessage, $"<color={MsgSayColor}>{MsgSayPrefix} {player.playerData.username}: {arg1.FilterString()}</color>"); }
public static void Run(SvPlayer player, string message) { var arg1 = GetArgument.Run(1, false, false, message); // (int)DelayInSeconds var arg2 = GetArgument.Run(2, false, false, message); // (int)Price var arg3 = GetArgument.Run(3, false, true, message); // (string)KitName if (string.IsNullOrEmpty(arg1.Trim()) || string.IsNullOrEmpty(arg2.Trim()) || string.IsNullOrEmpty(arg3.Trim())) { player.SendChatMessage(ArgRequired); return; } if (!int.TryParse(arg1, out int arg1i) || !int.TryParse(arg2, out int arg2i)) { player.SendChatMessage($"<color={errorColor}>Cannot convert {arg1} or {arg2} to a integer.</color>"); return; } if (arg1i < 0) { player.SendChatMessage($"<color={errorColor}>The delay must be a positive number (0 to disable)</color>"); return; } if (player.InApartment()) { player.SendChatMessage($"<color={errorColor}>You cannot set a warp inside any apartment, as they are not fixed places.</color>"); return; } var file = Path.Combine(WarpDirectory, $"{arg3}.json"); if (File.Exists(file)) { player.SendChatMessage($"<color={errorColor}>A warp already exists with that name.</color>"); return; } var obj = new WarpHandler.JsonModel { Delay = arg1i, Price = arg2i < 0 ? 0 : arg2i, Name = arg3, ExecutableBy = "everyone", Position = new WarpHandler.Position { X = player.player.GetPosition().x, Y = player.player.GetPosition().y, Z = player.player.GetPosition().z, PlaceIndex = player.player.GetPlaceIndex() }, Rotation = new WarpHandler.Rotation { X = player.player.GetRotation().x, Y = player.player.GetRotation().y, Z = player.player.GetRotation().z, W = player.player.GetRotation().w } }; Variables.WarpHandler.CreateNew(obj, arg3); player.SendChatMessage($"<color={infoColor}>Warp created. Please edit </color><color={argColor}>{file}</color> <color={infoColor}>to add ExecuteableBy.</color>"); }
public static void Run(SvPlayer player, string message) { var arg1 = GetArgument.Run(1, false, true, message); if (string.IsNullOrEmpty(arg1.Trim())) { player.SendChatMessage(ArgRequired); return; } if (!Variables.KitsHandler.List.Any(x => x.Name == arg1)) { player.SendChatMessage($"<color={errorColor}>That kit doesn't exist.</color>"); return; } var obj = Variables.KitsHandler.List.FirstOrDefault(x => x.Name == arg1); if (!HasPermission.Run(player, obj.ExecutableBy, false, player.player.job.jobIndex)) { player.SendChatMessage($"<color={errorColor}>You do not have access to that kit.</color>"); return; } if (obj.Disabled) { player.SendChatMessage($"<color={errorColor}>That kit is currently disabled.</color>"); return; } if (obj.CurrentlyInCooldown.ContainsKey(player.player.username)) { player.SendChatMessage($"<color={errorColor}>You already used this kit. Please wait</color> <color={argColor}>{obj.CurrentlyInCooldown[player.player.username]}</color> <color={errorColor}>second(s) before executing this command again.</color>"); return; } if (obj.Price > 0) { if (player.player.MyMoneyCount() < obj.Price) { player.SendChatMessage($"<color={errorColor}>You do not have enough money to get this kit. (You have: {player.player.MyMoneyCount()} | Needed: {obj.Price})</color>"); return; } player.player.TransferMoney(DeltaInv.RemoveFromMe, obj.Price, true); } foreach (var item in obj.Items) { player.player.TransferItem(DeltaInv.AddToMe, item.Id, item.Amount, true); } if (obj.Delay > 0) { SvMan.StartCoroutine(Variables.KitsHandler.StartCooldown(player.player.username, obj)); } player.SendChatMessage($"<color={infoColor}>You've been given the kit</color> <color={argColor}>{arg1}</color><color={infoColor}>.{(obj.Delay > 0 ? $" You can get this kit again in {obj.Delay} seconds." : "")}</color>"); }
public static void Run(SvPlayer player, string message) { string correctSyntax = $"<color={argColor}>{GetArgument.Run(0, false, false, message)}</color> <color={errorColor}>[Player] [Amount]</color> <color={warningColor}>(Incorrect or missing argument(s).)</color>"; string arg1 = GetArgument.Run(1, false, true, message); string arg2 = message.Split(' ').Last().Trim(); if (string.IsNullOrEmpty(GetArgument.Run(1, false, false, message)) || string.IsNullOrEmpty(arg2)) { player.SendChatMessage(correctSyntax); return; } int lastIndex = arg1.LastIndexOf(" ", StringComparison.CurrentCulture); if (lastIndex != -1) { arg1 = arg1.Remove(lastIndex).Trim(); } var parsedSuccessfully = int.TryParse(arg2, out int arg2Int); if (!parsedSuccessfully) { player.SendChatMessage(correctSyntax); return; } if (arg2Int <= 0) { player.SendChatMessage($"<color={errorColor}>Cannot transfer 0$ or less.</color>"); return; } var currPlayer = GetShByStr.Run(arg1); if (currPlayer == null) { player.SendChatMessage(NotFoundOnline); return; } if (player.player.MyMoneyCount() < arg2Int) { player.SendChatMessage($"<color={errorColor}>Cannot transfer money, do you have</color> <color={argColor}>{arg2Int}</color><color={errorColor}>$ in your inventory?</color>"); return; } player.player.TransferMoney(DeltaInv.RemoveFromMe, arg2Int, true); currPlayer.TransferMoney(DeltaInv.AddToMe, arg2Int, true); player.SendChatMessage($"<color={infoColor}>Successfully transfered</color> <color={argColor}>{arg2Int}</color><color={infoColor}>$ to </color><color={argColor}>{currPlayer.username}</color><color={infoColor}>!</color>"); currPlayer.svPlayer.SendChatMessage($"<color={argColor}>{player.player.username}</color><color={infoColor}> gave you </color><color={argColor}>{arg2Int}</color><color={infoColor}>$!</color>"); }
public static void Run(SvPlayer player, string message) { var arg1 = GetArgument.Run(1, false, false, message); var found = 0; if (string.IsNullOrEmpty(arg1)) { player.SendChatMessage(GetArgument.Run(0, false, false, message) + "[IP/IGN] [Arg2] Eg " + GetArgument.Run(0, false, false, message) + " ip 127.0.0.1"); return; } var arg2 = GetArgument.Run(2, false, true, message); if (arg1.Equals("ip", StringComparison.InvariantCultureIgnoreCase)) { var content = "Possible accounts using the IP " + arg2 + ":\r\n\r\n"; var builder = new StringBuilder(); builder.Append(content); foreach (var line in File.ReadAllLines(IpListFile)) { if (line.EndsWith(arg2, StringComparison.CurrentCulture)) { ++found; builder.Append(line.Replace(": " + arg2, string.Empty) + "\r\n"); } } content = builder.ToString(); content += "\r\n\r\n" + arg2 + " occurred " + found + " times in the iplog file." + "\r\n"; player.Send(SvSendType.Self, Channel.Reliable, ClPacket.ServerInfo, content); } else if (arg1.Equals("ign", StringComparison.InvariantCultureIgnoreCase) || (arg1.Equals(nameof(player), StringComparison.InvariantCultureIgnoreCase))) { var content = "Possible logins on the account " + arg2 + " using the following IP's:\r\n\r\n"; var builder = new StringBuilder(); builder.Append(content); foreach (var line in File.ReadAllLines(IpListFile)) { if (line.StartsWith(arg2 + ": ", StringComparison.CurrentCulture)) { ++found; builder.Append(line.Replace(arg2 + ": ", string.Empty) + "\r\n"); } } content = builder.ToString(); content = content + "\r\n\r\n" + arg2 + " occurred " + found + " times in the iplog file." + "\r\n"; player.Send(SvSendType.Self, Channel.Reliable, ClPacket.ServerInfo, content); } }
public static void Run(SvPlayer player, string message) { var arg1 = GetArgument.Run(1, false, true, message); if (string.IsNullOrEmpty(arg1.Trim())) { player.SendChatMessage(ArgRequired); return; } if (!Variables.WarpHandler.List.Any(x => x.Name == arg1)) { player.SendChatMessage($"<color={errorColor}>That warp doesn't exist.</color>"); return; } var obj = Variables.WarpHandler.List.FirstOrDefault(x => x.Name == arg1); if (!HasPermission.Run(player, obj.ExecutableBy, false, player.player.job.jobIndex)) { player.SendChatMessage($"<color={errorColor}>You do not have access to that warp.</color>"); return; } if (obj.Disabled) { player.SendChatMessage($"<color={errorColor}>That warp is currently disabled.</color>"); return; } if (obj.CurrentlyInCooldown.ContainsKey(player.player.username)) { player.SendChatMessage($"<color={errorColor}>You already went to that warp. Please wait</color> <color={argColor}>{obj.CurrentlyInCooldown[player.player.username]}</color> <color={errorColor}>second(s) before executing this command again.</color>"); return; } if (obj.Price > 0) { if (player.player.MyMoneyCount() < obj.Price) { player.SendChatMessage($"<color={errorColor}>You do not have enough money to pay for this warp. (You have: {player.player.MyMoneyCount()} | Needed: {obj.Price})</color>"); return; } player.player.TransferMoney(DeltaInv.RemoveFromMe, obj.Price, true); } player.ResetAndSavePosition(new Vector3(obj.Position.X, obj.Position.Y, obj.Position.Z), new Quaternion(obj.Rotation.X, obj.Rotation.Y, obj.Rotation.Z, obj.Rotation.W), obj.Position.PlaceIndex); if (obj.Delay > 0) { SvMan.StartCoroutine(Variables.WarpHandler.StartCooldown(player.player.username, obj)); } player.SendChatMessage($"<color={infoColor}>You've been teleported to the warp named</color> <color={argColor}>{arg1}</color><color={infoColor}>.{(obj.Delay > 0 ? $" You can teleport to this warp again in {obj.Delay} seconds." : "")}</color>"); }
public static void Run(SvPlayer player, string message) { string arg1 = GetArgument.Run(1, false, false, message); string arg2 = GetArgument.Run(2, false, true, message); byte arg1Parsed = 10; string msg = $"<color={infoColor}>Set </color><color={argColor}>{{0}}</color><color={infoColor}>'s Job to</color> <color={argColor}>{{1}}</color><color={infoColor}>.</color>"; if (string.IsNullOrEmpty(arg2)) { arg2 = player.player.username; } if (string.IsNullOrEmpty(arg1)) { player.SendChatMessage(NotValidArg); return; } bool parsedCorrectly = true; if (Jobs.Contains(arg1)) { arg1Parsed = Convert.ToByte((Array.IndexOf(Jobs, arg1))); } else { parsedCorrectly = byte.TryParse(arg1, out arg1Parsed); } if (!parsedCorrectly) { player.SendChatMessage(NotValidArg); return; } if (arg1Parsed > player.player.jobs.Length || arg1Parsed < 0) { player.SendChatMessage($"<color={errorColor}>Error: The value must be between 0 and {player.player.jobs.Length}.</color>"); return; } var currPlayer = GetShByStr.Run(arg2); if (currPlayer == null) { player.SendChatMessage(NotFoundOnline); return; } player.SendChatMessage(string.Format(msg, currPlayer.username, Jobs[arg1Parsed])); currPlayer.svPlayer.SvSetJob(player.player.jobs[arg1Parsed], true, false); }
public static void Run(SvPlayer player, string message) { string arg1 = GetArgument.Run(1, false, true, message); if (string.IsNullOrEmpty(arg1)) { player.Send(SvSendType.Self, Channel.Reliable, ClPacket.GameMessage, $"<color={errorColor}>Missing argument! Correct syntax:</color> <color={warningColor}>{GetArgument.Run(0, false, false, message)} [player]</color>"); return; } var currPlayer = GetShByStr.Run(arg1); if (currPlayer == null) { player.SendChatMessage(NotFoundOnline); return; } if (currPlayer == player.player) { player.Send(SvSendType.Self, Channel.Reliable, ClPacket.GameMessage, $"<color={errorColor}>Hey! You cannot report yourself, dummy.</color>"); return; } if (player.player.admin) { player.Send(SvSendType.Self, Channel.Reliable, ClPacket.GameMessage, $"<color={errorColor}>Hey! You cannot report as admin.</color>"); return; } if (currPlayer.admin) { player.Send(SvSendType.Self, Channel.Reliable, ClPacket.GameMessage, $"<color={errorColor}>Hey! You cannot report an admin.</color>"); return; } var builder = new StringBuilder(); builder.Append("<color=#00ffffff>Reporting</color> <color=#ea8220>" + arg1 + "</color>\n<color=#00ffffff>Reason:</color>\n\n"); for (int i = 0; i < ReportReasons.Length; i++) { if (string.IsNullOrWhiteSpace(ReportReasons[i])) { continue; } builder.Append("<color=#00ffffff>F" + (i + 2) + ":</color> " + ReportReasons[i] + "\n"); } player.Send(SvSendType.Self, Channel.Reliable, ClPacket.ShowFunctionMenu, builder + "\n<color=#00ffffff>Press</color> <color=#ea8220>F11</color> <color=#00ffffff>To close this (G)UI</color>"); PlayerList[player.player.ID].LastMenu = CurrentMenu.Report; PlayerList[player.player.ID].ReportedPlayer = currPlayer; }
public static void Run(SvPlayer player, string message) { var arg1 = GetArgument.Run(1, false, false, message); // (int)DelayInSeconds var arg2 = GetArgument.Run(2, false, false, message); // (int)Price var arg3 = GetArgument.Run(3, false, true, message); // (string)KitName if (string.IsNullOrEmpty(arg1.Trim()) || string.IsNullOrEmpty(arg2.Trim()) || string.IsNullOrEmpty(arg3.Trim())) { player.SendChatMessage(ArgRequired); return; } if (!int.TryParse(arg1, out int arg1i) || !int.TryParse(arg2, out int arg2i)) { player.SendChatMessage($"<color={errorColor}>Cannot convert {arg1} or {arg2} to a integer.</color>"); return; } if (arg1i < 0) { player.SendChatMessage($"<color={errorColor}>The delay must be a positive number (0 to disable)</color>"); return; } var file = Path.Combine(KitDirectory, $"{arg3}.json"); if (File.Exists(file)) { player.SendChatMessage($"<color={errorColor}>A kit already exists with that name.</color>"); return; } var obj = new KitsHandler.JsonModel { Delay = arg1i, Price = arg2i < 0 ? 0 : arg2i, Name = arg3, ExecutableBy = "everyone" }; foreach (var item in player.player.myItems.Values) { obj.Items.Add(new KitsHandler.Kits_Item { Amount = item.count, Id = item.item.index }); } Variables.KitsHandler.CreateNew(obj, arg3); player.SendChatMessage($"<color={infoColor}>Kit created. Please edit </color><color={argColor}>{file}</color> <color={infoColor}>to add ExecuteableBy.</color>"); }
public static void Run(SvPlayer player, string message) { string arg1 = GetArgument.Run(1, false, true, message); if (string.IsNullOrEmpty(arg1)) { arg1 = player.player.username; } var currPlayer = GetShByStr.Run(arg1); if (currPlayer == null) { player.SendChatMessage(NotFoundOnline); return; } currPlayer.RestoreStats(); player.SendChatMessage($"<color={infoColor}>Maxed stats for</color> <color={argColor}>{currPlayer.username}</color><color={infoColor}>.</color>"); }
public static void Run(SvPlayer player, string message) { string arg1 = GetArgument.Run(1, false, true, message); if (string.IsNullOrEmpty(arg1)) { arg1 = player.player.username; } var currPlayer = GetShByStr.Run(arg1); if (currPlayer == null) { player.SendChatMessage(NotFoundOnline); return; } currPlayer.ClearCrimes(); currPlayer.svPlayer.Send(SvSendType.Self, Channel.Reliable, ClPacket.ClearCrimes, currPlayer.ID); player.SendChatMessage($"<color={infoColor}>Cleared crimes of '{currPlayer.username}'.</color>"); }
public static void Run(SvPlayer player, string message) { string arg1 = GetArgument.Run(1, false, true, message); if (string.IsNullOrEmpty(arg1)) { player.SendChatMessage(ArgRequired); return; } var shPlayer = GetShByStr.Run(arg1); if (shPlayer == null) { player.SendChatMessage(NotFoundOnline); return; } player.ResetAndSavePosition(shPlayer.GetPosition(), shPlayer.GetRotation(), shPlayer.GetPlaceIndex()); player.SendChatMessage($"<color={infoColor}>Teleported to</color> <color={argColor}>{shPlayer.username}</color><color={infoColor}>.</color>"); }
public static void Run(SvPlayer player, string message) { string arg1 = GetArgument.Run(1, false, true, message); if (string.IsNullOrEmpty(arg1)) { player.SendChatMessage(ArgRequired); return; } var currPlayer = GetShByStr.Run(arg1); if (currPlayer == null) { player.SendChatMessage(NotFoundOnline); return; } currPlayer.svPlayer.SvSuicide(); player.SendChatMessage($"<color={infoColor}>Killed</color> <color={argColor}>{currPlayer.username}</color><color={infoColor}>.</color>"); }
public static void Run(SvPlayer player, string message) { string arg1 = GetArgument.Run(1, false, true, message); if (string.IsNullOrEmpty(arg1)) { player.SendChatMessage(ArgRequired); return; } var shPlayer = GetShByStr.Run(arg1); if (shPlayer == null) { player.SendChatMessage(NotFoundOnline); return; } player.svManager.Kick(shPlayer.svPlayer.connection); player.SendChatMessage($"<color={infoColor}>Kicked</color> <color={argColor}>{shPlayer.username}</color><color={infoColor}>.</color>"); }
public static void Run(SvPlayer player, string message) { var arg1 = GetArgument.Run(1, false, true, message); if (string.IsNullOrEmpty(arg1.Trim())) { player.SendChatMessage(ArgRequired); return; } var file = Path.Combine(WarpDirectory, $"{arg1}.json"); if (!File.Exists(file)) { player.SendChatMessage($"<color={errorColor}>No warps exist with that name.</color>"); return; } Variables.WarpHandler.DeleteExisting(arg1); player.SendChatMessage($"<color={infoColor}>Warp deleted.</color>"); }