Option for real-time on specific daysSuggestion
Hi.
I would find it very useful if you could run a command at a specific time and day of the week.
E.g. Monday 06:00
This would be very useful for server events that only happen on certain days.
I think that this would be very useful!
Can dev to add it ?
Thank You so much
Is there a way to set a message to post at a specific day/time?
Ex) Sunday's at 0155 then it executes a server.save at 0159
I currently have this setup:
{
"EnableInGameTime-Timer": false,
"EnableRealTime-Timer": false,
"EnableTimerOnce": false,
"EnableTimerRepeat": true,
"InGameTime-Timer": {
"01:00": "weather rain",
"12:00": "command 1",
"15:00": "command 2"
},
"RealTime-Timer": {
},
"TimerOnce": {
"command1 'msg'": 60,
"command2 'msg'": 120,
"command3 arg": 180,
"reset.timeronce": 181
},
"TimerRepeat": {
"o.reload DiscordAuth": 3600,
"o.reload DiscordStatus": 3620
}
} example:
Monday 10:00 AM oxide.unload PvPserver.cs
Wednesday 11:00 AM oxide.load PvPserver.cs
Friday 4:00 PM oxide.load Fireworks.cs
so its just an exemple.. is that possible i a way?
greetings
Would be great with the option to add weekdays e.g Monday 13:00 some command Hope this change can be made
I have the solutionDuderino
Monday 10:00 AM oxide.unload PvPserver.cs
Wednesday 11:00 AM oxide.load PvPserver.cs
Friday 4:00 PM oxide.load Fireworks.cs
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; BeMann's solution works flawlessly. Thanks!!!
Is there any way we can get that merged with the original plugin so people like me that arent code savvy won't mess up our plugins?
- 1
- 2