public static void PlayerKill(int playerId) { if (!config.SpeedSpree) { return; } // Console.WriteLine(playerId + " kill set"); if (speedTimers[playerId] == null) { speedTimers[playerId] = new Timer(); speedTimers[playerId].Elapsed += new ElapsedEventHandler(TimerHasExpired); // Console.WriteLine(playerId + " new kill set"); } if (Statistics.statsDebug) { string output = "You have " + KillingSpree.FormatTimeSpan(new TimeSpan(0, 0, config.SpeedSpreeTimeout)) + "to kill something. " + DateTime.Now; TShock.Players[playerId].SendMessage(output, Convert.ToByte(config.SpeedSpreeColor[0]), Convert.ToByte(config.SpeedSpreeColor[1]), Convert.ToByte(config.SpeedSpreeColor[2])); if (config.tellConsole) { Announcements.ConsoleSendMessage(output); } } speedTimers[playerId].Stop(); speedTimers[playerId].Interval = config.SpeedSpreeTimeout * 1000; speedTimers[playerId].AutoReset = false; speedTimers[playerId].Start(); }
public static void StartSpeedKill() { string output = "Speed Spree is already running, use -stop first."; if (config.SpeedSpree) { if (config.tellConsole) { Announcements.ConsoleSendMessage(output); } return; } if (Statistics.statsDebug) { output = "Speed Spree has now started. You will have " + KillingSpree.FormatTimeSpan(new TimeSpan(0, 0, config.SpeedSpreeTimeout)) + "to kill."; TSPlayer.All.SendMessage(output, Convert.ToByte(config.SpeedSpreeColor[0]), Convert.ToByte(config.SpeedSpreeColor[1]), Convert.ToByte(config.SpeedSpreeColor[2])); if (config.tellConsole) { Announcements.ConsoleSendMessage(output); } } config.SpeedSpree = true; }