Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Here are the chat commands
- Commands.ChatCommands.Add(new Command("TicketClear", TicMonth, "TicMonth", "Ticmonth", "ticmonth", "ticMonth"));
- Commands.ChatCommands.Add(new Command("TicketClear", TicDay, "TicDay", "Ticday", "ticday", "ticDay"));
- Commands.ChatCommands.Add(new Command("TicketClear", TicYear, "TicYear", "Ticyear", "ticyear", "ticYear"));
- //Here is some of the Switch Case
- case "day": //I need to figure this out soon
- args.Player.SendMessage("Coming Soon!", Color.Gold);
- Console.ForegroundColor = ConsoleColor.Yellow;
- Console.WriteLine(string.Format("{0} tried to access the command: ticketclear day, but it can't be accessed because it isn't part of the plugin yet. It is coming soon.", args.Player.Name));
- Console.ResetColor();
- break;
- default:
- args.Player.SendMessage("Syntax: all or day.", Color.Red);
- break;
- public static void TicMonth(CommandArgs args)
- {
- if (args.Parameters.Count == 1)
- {
- if (i == 1)
- {
- string mm = args.Parameters[0];
- StreamWriter tw = new StreamWriter("TempClear.txt", true);
- tw.WriteLine(mm);
- tw.Close();
- args.Player.SendMessage("You have set the Month!");
- args.Player.SendMessage("Selecting a day: use /ticday <dd>");
- i++;
- }
- else
- {
- args.Player.SendMessage("You have not selected /ticketclear day.", Color.Red);
- }
- }
- else if (args.Parameters.Count > 1)
- {
- if (i == 1)
- {
- args.Player.SendMessage("You can't input more than one option!", Color.Red);
- }
- else
- {
- args.Player.SendMessage("You have not selected /ticketclear day.", Color.Red);
- }
- }
- else if (args.Parameters.Count < 1)
- {
- if (i == 1)
- {
- args.Player.SendMessage("Syntax: /ticmonth <mm>", Color.Red);
- }
- else
- {
- args.Player.SendMessage("You have not selected /ticketclear day.", Color.Red);
- }
- }
- }
- public static void TicDay(CommandArgs args)
- {
- if (args.Parameters.Count == 1)
- {
- if (i == 2)
- {
- string dd = args.Parameters[0];
- StreamWriter tw = new StreamWriter("TempClear.txt", true);
- tw.WriteLine(dd);
- tw.Close();
- args.Player.SendMessage("You have set the day!");
- args.Player.SendMessage("Selecting a year: use /ticyear <yyyy>");
- i++;
- }
- else
- {
- args.Player.SendMessage("You have not selected /ticketclear day.", Color.Red);
- }
- }
- else if (args.Parameters.Count > 1)
- {
- if (i == 2)
- {
- args.Player.SendMessage("You can't input more than one option!", Color.Red);
- }
- else
- {
- args.Player.SendMessage("You have not selected /ticketclear day.", Color.Red);
- }
- }
- else if (args.Parameters.Count < 1)
- {
- if (i == 2)
- {
- args.Player.SendMessage("Syntax: /ticday <dd>", Color.Red);
- }
- else
- {
- args.Player.SendMessage("You have not selected /ticketclear day.", Color.Red);
- }
- }
- }
- public static void TicYear(CommandArgs args)
- {
- if (args.Parameters.Count == 1)
- {
- if (i == 3)
- {
- string yyyy = args.Parameters[0];
- StreamWriter tw = new StreamWriter("TempClear.txt", true);
- tw.WriteLine(yyyy);
- tw.Close();
- args.Player.SendMessage("You have set the date!");
- args.Player.SendMessage("Clearing that day...");
- StreamReader tics = new StreamReader("Tickets.txt", true);
- StreamWriter ticclear = new StreamWriter("Tickets.txt", true);
- StreamReader clear = new StreamReader("TempClear.txt", true);
- string line = null;
- string line_to_delete = clear.ReadToEnd();
- try
- {
- while ((line = clear.ReadLine()) != null)
- {
- while ((line = tics.ReadLine()) != null)
- {
- if (String.Compare(line, line_to_delete) == 0)
- continue;
- tics.Close();
- clear.Close();
- ticclear.WriteLine(line);
- ticclear.Close();
- }
- }
- }
- catch (Exception e)
- {
- args.Player.SendMessage("Something went wrong and you couldnt clear that date.", Color.Red);
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine(e.Message);
- Console.ResetColor();
- }
- i = 0;
- File.Delete("TempClear.txt");
- }
- else
- {
- args.Player.SendMessage("You have not selected /ticketclear day.", Color.Red);
- }
- }
- else if (args.Parameters.Count > 1)
- {
- if (i == 3)
- {
- args.Player.SendMessage("You can't input more than one option!", Color.Red);
- }
- else
- {
- args.Player.SendMessage("You have not selected /ticketclear day.", Color.Red);
- }
- }
- else if (args.Parameters.Count < 1)
- {
- if (i == 3)
- {
- args.Player.SendMessage("Syntax: /ticyear <yyyy>", Color.Red);
- }
- else
- {
- args.Player.SendMessage("You have not selected /ticketclear day.", Color.Red);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement