Jump to content
Sign in to follow this  
TisCollier

Server Time

Recommended Posts

I can't seem to get a custom time running on my server using

serverTime="2015/4/8/17/23"; 

It does not seem to set the custom time just continues with System Time.

Share this post


Link to post
Share on other sites

It's a common issue every server is having right now.

 

This fix is supposed to skip skip night, so when it's 8PM the server will set ti's time to 7AM:


 

1. Open Mpmissions - dayzOffline.chernarusplus - init.c
2. At the top add:

#include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\Correct_InGame_time.c"

3. under the line: weather.SetWindFunctionParams

add: GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(Correct_InGame_time, 1000, true);

4. Create a file manually with the name "Correct_InGame_time.c" and fill it with the following text:

static void Correct_InGame_time()
{
    private int year, month, day, hour, minute;
    GetGame().GetWorld().GetDate( year, month, day, hour, minute );
    
    if ((hour < 7) || (hour >= 20))
    {
        if (hour < 7)
        {
            GetGame().GetWorld().SetDate(year, month, day, 7, 3);
        }
        if (hour >= 20)
        {
            GetGame().GetWorld().SetDate(year, month, (day + 1), 7, 3);
        }
    }
}

 

Share this post


Link to post
Share on other sites

I simply added    GetGame().GetWorld().SetDate(2018, 6, 12, 7, 3); in the init.c file immediately after the weather settings and it seems to be working so far.  I tried all the other fixes and they worked for a few restarts then the server was dark again.   This keeps the server at a set time until the Dev's fix the issue.

Share this post


Link to post
Share on other sites
54 minutes ago, Emazeg said:

I simply added    GetGame().GetWorld().SetDate(2018, 6, 12, 7, 3); in the init.c file immediately after the weather settings and it seems to be working so far.  I tried all the other fixes and they worked for a few restarts then the server was dark again.   This keeps the server at a set time until the Dev's fix the issue.

Working for me so far.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×