LeGend NOOB!
Posts : 18 Join date : 2009-05-09 Age : 31 Location : California
| Subject: [Release]Console Commands Sat May 09, 2009 5:34 pm | |
| Well, to avoid any further useless posts on this subject... here are a ton of console based commands that will control the game from the server console. I will not explain what each does, it should be pretty easy to figure out, and I don't intend to answer stupid questions. If its a good question, I will answer it. - Code:
-
public static void DoStuff() { bool flag = true; Console.Clear(); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("*^* Console Command Successfully Loaded *^*"); Console.WriteLine(""); Console.ResetColor(); Console.WriteLine("-- Type .help for a list of the available commands --"); while (flag) { string str; str = Console.ReadLine(); if (str == ".close") { try { foreach (DictionaryEntry DE in World.AllChars) { Character Char = (Character)DE.Value; DataBase.ChangeOnlineStatus(Char.MyClient.Account, 0); } World.SaveAllChars(); sw.Flush(); sw.Close(); DataBase.AllOffline(); Environment.Exit(Environment.ExitCode); } catch { } } if (str == ".restart") { World.SendMsgToAll("Server Restart in 10 seconds!", "SYSTEM", 2011); new Thread(new ThreadStart( delegate() { Console.WriteLine("Server Restarting in 10 seconds!"); Thread.Sleep(10000); General.ServerRestart(); } )).Start(); } if (str == ".clear") { Console.Clear(); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("*^* Server Source *^*"); Console.WriteLine("-=-=-=-=-=-=-=-=-=-="); Console.ResetColor(); } if (str == ".help") { Console.WriteLine("\nCurrent Console Commands: \n.clear - Clears Console \n.restart - Restarts Server \n.close - Closes Server (and saves characters) \n.message - Sends in-Game GM Message \n.sm - Automated 5-minute Server Maintenance Command\n.playershow - Shows who is on and how many clients are connected to the server."); } if (str == ".sm") { World.SendMsgToAll("Server Maintanience in 5 minutes! Please log off to avord data lost!", "SYSTEM", 2011); new Thread(new ThreadStart( delegate() { Console.WriteLine("Server Maintenance Command Activated (via Console)."); Thread.Sleep(30000); // 30 second World.SendMsgToAll("Server Maintenance in 4 minutes and 30 Seconds! Please Log off to prevent data loss!", "SYSTEM", 2011); Console.WriteLine("4:30 Minutes Left"); Thread.Sleep(30000); // 30 second World.SendMsgToAll("Server Maintenance in 4 minutes! Please Log off to prevent data loss!", "SYSTEM", 2011); Console.WriteLine("4 Minutes Left"); Thread.Sleep(30000); // 30 second World.SendMsgToAll("Server Maintenance in 3 minutes and 30 Seconds! Please Log off to prevent data loss!", "SYSTEM", 2011); Console.WriteLine("3:30 Minutes Left"); Thread.Sleep(30000); // 30 second World.SendMsgToAll("Server Maintenance in 3 minutes! Please Log off to prevent data loss!", "SYSTEM", 2011); Console.WriteLine("3 Minutes Left"); Thread.Sleep(30000); // 30 second World.SendMsgToAll("Server Maintenance in 2 minutes and 30 Seconds! Please Log off to prevent data loss!", "SYSTEM", 2011); Console.WriteLine("2:30 Minutes Left"); Thread.Sleep(30000); // 30 second World.SendMsgToAll("Server Maintenance in 2 minutes! Please Log off to prevent data loss!", "SYSTEM", 2011); Console.WriteLine("2 Minutes Left"); Thread.Sleep(30000); // 30 second World.SendMsgToAll("Server Maintenance in 1 minute and 30 Seconds! Please Log off to prevent data loss!", "SYSTEM", 2011); Console.WriteLine("1:30 Minutes Left"); Thread.Sleep(30000); // 30 second World.SendMsgToAll("Server Maintenance in 1 minute! Please Log off to prevent data loss!", "SYSTEM", 2011); Console.WriteLine("1 Minute Left"); Thread.Sleep(30000); // 30 second World.SendMsgToAll("Server Maintenance in 30 Seconds! Please Log off to prevent data loss!", "SYSTEM", 2011); Console.WriteLine("0:30 Seconds Left"); Thread.Sleep(30000); // 30 second World.SendMsgToAll("Server Maintenance for 30 minutes! Please Log off to prevent data loss!", "SYSTEM", 2011); Thread.Sleep(10000); // 30 second Console.WriteLine("Server is now shutting down..."); try { foreach (DictionaryEntry DE in World.AllChars) { Character Char = (Character)DE.Value; DataBase.ChangeOnlineStatus(Char.MyClient.Account, 0); } World.PlayersOffLottery(); World.SaveAllChars(); sw.Flush(); sw.Close(); DataBase.AllOffline(); Environment.Exit(Environment.ExitCode); } catch { }
} )).Start();
} if (str.StartsWith(".message")) { string msg; msg = str.Substring(8); World.SendMsgToAll(msg, "SYSTEM", 2011); Console.WriteLine("Sent Message"); } if (str.StartsWith(".playershow")) { string BackMsg = ""; foreach (DictionaryEntry DE in World.AllChars) { Character Char = (Character)DE.Value; BackMsg += Char.Name + ", "; } if (BackMsg.Length > 1) BackMsg = BackMsg.Remove(BackMsg.Length - 2, 2); Console.WriteLine("Players Online: " + World.AllChars.Count + "\n" + BackMsg);
} } } | |
|