public string[] OnCall(ICommandSender sender, string[] args) { CustomAnnouncements.ann = UnityEngine.Object.FindObjectOfType <NineTailedFoxAnnouncer>(); if (!an.CanRunCommand(sender)) { return new string[] { "You are not allowed to run this command." } } ; if (args.Length > 0) { if (!Int32.TryParse(args[0], out int a)) { return new string[] { "Error: not a valid number." } } ; return(an.PlaySCPAnnouncement(args[0], "Announcement has been made.")); } else { return(new string[] { GetUsage() }); } } } }
public string[] OnCall(ICommandSender sender, string[] args) { CustomAnnouncements.ann = UnityEngine.Object.FindObjectOfType <NineTailedFoxAnnouncer>(); if (!an.CanRunCommand(sender)) { return new string[] { "You are not allowed to run this command." } } ; if (args.Length > 0) { if (args[0].ToLower() == "set") { if (args.Length > 1) { string text = CustomAnnouncements.StringArrayToString(args, 1); return(an.SetAnnouncement(text, "Player escape announcement set.")); } } else if (args[0].ToLower() == "view") { return(an.ViewAnnouncement("Error: announcement has not been set.")); } else if (args[0].ToLower() == "clear") { return(an.ClearAnnouncement("Player escape announcement cleared.")); } } return(new string[] { GetUsage() }); } }
public string[] OnCall(ICommandSender sender, string[] args) { CustomAnnouncements.ann = UnityEngine.Object.FindObjectOfType <NineTailedFoxAnnouncer>(); if (!an.CanRunCommand(sender)) { return new string[] { "You are not allowed to run this command." } } ; if (args.Length > 1) { int start, end = 0; if (int.TryParse(args[0], out int a)) { start = a; } else { return(new string[] { "Not a valid number!" }); } if (int.TryParse(args[1], out int b)) { end = b; } else { return(new string[] { "Not a valid number!" }); } string[] statement = GetCountdown(start, end); if (statement != null) { if (args.Length > 2) { string saveText = CustomAnnouncements.HandleNumbers(CustomAnnouncements.SpacePeriods(CustomAnnouncements.StringArrayToString(args, 2))); return(an.PlayCustomAnnouncement(string.Join(" ", statement) + " . . " + CustomAnnouncements.ReplaceVariables(saveText), "Countdown started.")); } else { return(an.PlayCustomAnnouncement(string.Join(" ", statement), "Countdown started.")); } } else { return(new string[] { "Error: starting value is less than or equal to ending value." }); } } return(new string[] { GetUsage() }); } }
public string[] OnCall(ICommandSender sender, string[] args) { CustomAnnouncements.ann = UnityEngine.Object.FindObjectOfType <NineTailedFoxAnnouncer>(); if (!an.CanRunCommand(sender)) { return new string[] { "You are not allowed to run this command." } } ; if (args.Length > 0) { return(an.PlayCustomAnnouncement(CustomAnnouncements.StringArrayToString(args, 0), "Announcement has been made.")); } return(new string[] { GetUsage() }); } }
public string[] OnCall(ICommandSender sender, string[] args) { CustomAnnouncements.ann = UnityEngine.Object.FindObjectOfType <NineTailedFoxAnnouncer>(); if (!an.CanRunCommand(sender)) { return new string[] { "You are not allowed to run this command." } } ; if (args.Length > 0) { if (args[0].ToLower() == "save") { if (args.Length > 2) { string name = args[1]; if (name.ToLower() == "all" || name == "*") { return(new string[] { "Error: invalid preset name." }); } return(an.SetVariable(name, CustomAnnouncements.StringArrayToString(args, 2), "Error: Preset name already exists.", "Saved preset \"" + name + "\".")); } } else if (args[0].ToLower() == "load") { if (args.Length > 1) { return(an.LoadVariable(args[1], "Error: no presets saved.", "Error: couldn't find preset \"" + args[1] + "\".", "Loaded preset \"" + args[1] + "\".")); } } else if (args[0].ToLower() == "remove") { if (args.Length > 1) { return(an.RemoveVariable(args[1], "Error: there are no saved presets.", "Error: couldn't find preset \"" + args[1] + "\".", "Removed all presets.", "Removed preset \"" + args[1] + "\".")); } } else if (args[0].ToLower() == "list") { return(an.ListVariables("Error: there are no saved presets.")); } } return(new string[] { GetUsage() }); } }
public string[] OnCall(ICommandSender sender, string[] args) { CustomAnnouncements.ann = UnityEngine.Object.FindObjectOfType <NineTailedFoxAnnouncer>(); if (!an.CanRunCommand(sender)) { return new string[] { "You are not allowed to run this command." } } ; if (args.Length > 0) { if (args[0].ToLower() == "set") { if (args.Length > 1) { int time = 0; if (Int32.TryParse(args[1], out int a)) { time = a; } else { return new string[] { "Error: invalid time" } }; if (args.Length > 2) { return(an.SetVariable(time.ToString(), CustomAnnouncements.StringArrayToString(args, 2), "Error: Preset name already exists.", "Saved timer.")); } } } else if (args[0].ToLower() == "remove") { if (args.Length > 1) { return(an.RemoveVariable(args[1], "Error: there are no set timers.", "Error: couldn't find timer.", "Removed all timers.", "Removed timer.")); } } else if (args[0].ToLower() == "list") { return(an.ListVariables("Error: there are no set timers.")); } } return(new string[] { GetUsage() }); } } }
public string[] OnCall(ICommandSender sender, string[] args) { CustomAnnouncements.ann = UnityEngine.Object.FindObjectOfType <NineTailedFoxAnnouncer>(); if (!an.CanRunCommand(sender)) { return new string[] { "You are not allowed to run this command." } } ; if (args.Length == 3) { if (Int32.TryParse(args[0], out int a)) { int scpsLeft = a; } else { return(new string[] { "Error: not a valid number." }); } if (Int32.TryParse(args[1], out int b)) { int mtfNumber = b; } else { return(new string[] { "Error: not a valid number." }); } if (char.TryParse(args[2], out char c)) { char scpsLeft = c; } else { return(new string[] { "Error: not a valid letter." }); } return(an.PlayMTFAnnouncement(a, b, c, "Announcement has been made.")); } else { return(new string[] { GetUsage() }); } } }
public string[] OnCall(ICommandSender sender, string[] args) { CustomAnnouncements.ann = UnityEngine.Object.FindObjectOfType <NineTailedFoxAnnouncer>(); if (!an.CanRunCommand(sender)) { return new string[] { "You are not allowed to run this command." } } ; if (args.Length > 0) { if (args[0].ToLower() == "save") { if (args.Length > 2) { string name = "", id = ""; Player cPlayer = CustomAnnouncements.GetPlayer(args[1], out cPlayer); if (cPlayer != null) { name = cPlayer.Name; id = cPlayer.SteamId; } else if (ulong.TryParse(args[1], out ulong a)) { name = a.ToString(); id = a.ToString(); } else { return(new string[] { "Error: invalid player id." }); } return(an.SetVariable(id, CustomAnnouncements.StringArrayToString(args, 2), "Error: Player already exists.", "Saved announcement for player \"" + name + "\".")); } } else if (args[0].ToLower() == "remove") { if (args.Length > 1) { string name = "", id = ""; if (args[1].ToLower() != "all" && args[1] != "*") { Player cPlayer = CustomAnnouncements.GetPlayer(args[1], out cPlayer); if (cPlayer != null) { name = cPlayer.Name; id = cPlayer.SteamId; } else if (ulong.TryParse(args[1], out ulong a)) { name = a.ToString(); id = a.ToString(); } } else { id = "all"; } return(an.RemoveVariable(id, "Error: there are no player announcements.", "Error: couldn't find player \"" + name + "\".", "Removed all player announcements.", "Removed player \"" + name + "\".")); } } else if (args[0].ToLower() == "list") { return(an.ListVariables("Error: there are no player announcements.")); } } return(new string[] { GetUsage() }); } }