I am searching for Plugin or a way for Rust, to not reset the Server Events like Patrolhelicopter etc. when you skip the Night, and pls dont say timed events its broken since a while for me :)
Prevent server events being reset?
The code isn't changing the day, which causes the server to be stuck on the same day over and over. I just fixed this on my server. I can send you a link to fix this.
Merged post
Replace your VoteEnd Void with this:
private void VoteEnd(bool success)
{
VoteOpen = false;
RequiredVotes = 0;
VotingTimer.Destroy();
if (CountTimer != null) CountTimer.Destroy();
ReceivedVotes.Clear();
TimeRemaining = 0;
if (success)
{
DateTime newDate = server.Time.Date;
TimeSpan newTime = TimeSpan.Parse(configData.Options.TimeToSet);
newDate = newDate.AddDays(1);
DateTime newDateTime = newDate.Add(newTime);
server.Time = newDateTime;
server.Broadcast($"{configData.Messaging.MainColor}{GetMSG("Skipping the Night.")}</color>");
}
else
{
server.Broadcast($"{configData.Messaging.MainColor}{GetMSG("The attempt to skip the night has failed.")}</color>");
}
TimeCheck = timer.Once(configData.VoteTimers.TimeBetweenVotes * 60, () => CheckTime());
} All you need to do is to replace those 2 lines:
server.Time = server.Time.Date + TimeSpan.Parse(configData.Options.TimeToSet);
server.Time.Date.AddDays(1);with this one line:
server.Time = server.Time.Date.AddDays(1) + TimeSpan.Parse(configData.Options.TimeToSet);
Hope @k1lly0u will see this :)
MONaH
All you need to do is to replace those 2 lines:
server.Time = server.Time.Date + TimeSpan.Parse(configData.Options.TimeToSet); server.Time.Date.AddDays(1);with this one line:
server.Time = server.Time.Date.AddDays(1) + TimeSpan.Parse(configData.Options.TimeToSet);Hope @k1lly0u will see this :)
Build is currently failing, so can't merge it until that is resolved.
SkipNightVote.cs(137,60): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement still not fixed?
timed events will fix all this
Can confirm that MONaH's proposal works. I submitted a patch with the changes outlined above.