I have the solution
RealTimeDay-Timer0 = Sunday,
RealTimeDay-Timer1 = Monday,
RealTimeDay-Timer2 = Tuesday,
RealTimeDay-Timer3 = Wednesday,
RealTimeDay-Timer4 = Thursday,
RealTimeDay-Timer5 = Friday,
RealTimeDay-Timer6 = Saturday,
@misticos You are welcome to apply the changes to the plugin. If you allow me, I'll post the full code by then
You have to change the following 7 steps in the plugin:
STEP 1:add "RealTimeDay," to the enum Types from
public enum Types
{
RealTime,
InGameTime,
Repeater,
TimerOnce
};
to
public enum Types
{
RealTime,
RealTimeDay,
InGameTime,
Repeater,
TimerOnce
};
STEP 2:
Look for these lines
case Types.RealTime:
RunTimer(Types.RealTime);
break;
And add the following after it
case Types.RealTimeDay:
RunTimer(Types.RealTimeDay);
break;
STEP 3:
After this
case Types.RealTime:
if (Real != null) Real.Destroy();
Plugin.Puts("The RealTime timer has started");
AllTimers.Add(Real = Plugin.timer.Repeat(1, 0, () =>
{
foreach (var cmd in Plugin.Config["RealTime-Timer"] as Dictionary<string, object>)
if (System.DateTime.Now.ToString("HH:mm:ss") == cmd.Key.ToString())
{
Plugin.covalence.Server.Command(cmd.Value.ToString());
Plugin.Puts(string.Format("ran CMD: {0}", cmd.Value));
}
}
));
break;
Add this
case Types.RealTimeDay:
if (Real != null) Real.Destroy();
Plugin.Puts("The RealTimeDay timer has started");
AllTimers.Add(Real = Plugin.timer.Repeat(1, 0, () =>
{
foreach (var cmd in Plugin.Config["RealTimeDay-Timer"+(int)System.DateTime.Now.DayOfWeek] as Dictionary<string, object>)
if (System.DateTime.Now.ToString("HH:mm:ss") == cmd.Key.ToString())
{
Plugin.covalence.Server.Command(cmd.Value.ToString());
Plugin.Puts(string.Format("ran CMD: {0}", cmd.Value));
}
}
));
break;
STEP 4:
After
if (Convert.ToBoolean(Plugin.Config["EnableRealTime-Timer"]) == true)
RunTimer(Types.RealTime);
Add
if (Convert.ToBoolean(Plugin.Config["EnableRealTimeDay-Timer"]) == true)
RunTimer(Types.RealTimeDay);
STEP 5:
Replace
Dictionary<string, object> repeatcmds = new Dictionary<string, object>();
Dictionary<string, object> chaincmds = new Dictionary<string, object>();
Dictionary<string, object> realtimecmds = new Dictionary<string, object>();
Dictionary<string, object> ingamecmds = new Dictionary<string, object>();
to
Dictionary<string, object> repeatcmds = new Dictionary<string, object>();
Dictionary<string, object> chaincmds = new Dictionary<string, object>();
Dictionary<string, object> realtimecmds = new Dictionary<string, object>();
Dictionary<string, object> realtimedaycmds = new Dictionary<string, object>();
Dictionary<string, object> ingamecmds = new Dictionary<string, object>();
STEP 6:
Replace
if (Config["EnableTimerRepeat"] == null) Config["EnableTimerRepeat"] = true;
if (Config["EnableTimerOnce"] == null) Config["EnableTimerOnce"] = true;
if (Config["EnableRealTime-Timer"] == null) Config["EnableRealTime-Timer"] = true;
if (Config["EnableInGameTime-Timer"] == null) Config["EnableInGameTime-Timer"] = true;
to
if (Config["EnableTimerRepeat"] == null) Config["EnableTimerRepeat"] = true;
if (Config["EnableTimerOnce"] == null) Config["EnableTimerOnce"] = true;
if (Config["EnableRealTime-Timer"] == null) Config["EnableRealTime-Timer"] = true;
if (Config["EnableRealTimeDay-Timer"] == null) Config["EnableRealTimeDay-Timer"] = true;
if (Config["EnableInGameTime-Timer"] == null) Config["EnableInGameTime-Timer"] = true;
LAST STEP (STEP 7):
After
realtimecmds.Add("16:00:00", "command1 arg");
realtimecmds.Add("16:30:00", "command2 arg");
realtimecmds.Add("17:00:00", "command3 arg");
realtimecmds.Add("18:00:00", "command4 arg");
if (Config["RealTime-Timer"] == null) Config["RealTime-Timer"] = realtimecmds;
add
realtimedaycmds.Add("16:00:00", "command1 arg");
realtimedaycmds.Add("16:30:00", "command2 arg");
realtimedaycmds.Add("17:00:00", "command3 arg");
realtimedaycmds.Add("18:00:00", "command4 arg");
if (Config["RealTimeDay-Timer0"] == null) Config["RealTimeDay-Timer0"] = realtimedaycmds;
if (Config["RealTimeDay-Timer1"] == null) Config["RealTimeDay-Timer1"] = realtimedaycmds;
if (Config["RealTimeDay-Timer2"] == null) Config["RealTimeDay-Timer2"] = realtimedaycmds;
if (Config["RealTimeDay-Timer3"] == null) Config["RealTimeDay-Timer3"] = realtimedaycmds;
if (Config["RealTimeDay-Timer4"] == null) Config["RealTimeDay-Timer4"] = realtimedaycmds;
if (Config["RealTimeDay-Timer5"] == null) Config["RealTimeDay-Timer5"] = realtimedaycmds;
if (Config["RealTimeDay-Timer6"] == null) Config["RealTimeDay-Timer6"] = realtimedaycmds;