Jump to content
Violt

Server Resets game month every restart

Recommended Posts

Hey guys, 

I want my server to introduce Seasons. I noticed that the init.c resets the month to September the 20th every server restart. 

How do i make sure it doesn't reset so players experience different months thus temperatures?

 

    //DATE RESET AFTER ECONOMY INIT-------------------------
    int year, month, day, hour, minute;
    int reset_month = 9, reset_day = 20;
    GetGame().GetWorld().GetDate(year, month, day, hour, minute);

    if ((month == reset_month) && (day < reset_day))
    {
        GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
    }
    else
    {
        if ((month == reset_month + 1) && (day > reset_day))
        {
            GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
        }
        else
        {
            if ((month < reset_month) || (month > reset_month + 1))
            {
                GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
            }
        }
    }

Just remove that whole part? 

Edited by Violt

Share this post


Link to post
Share on other sites

Nevermind, 

Just edited a little. 

It now only makes sure the year is 2022 here's the new code: 

	//DATE RESET AFTER ECONOMY INIT-------------------------
	int year, month, day, hour, minute;
	int reset_year = 2022;
	GetGame().GetWorld().GetDate(year, month, day, hour, minute);

	if (year != reset_year)
	{
		GetGame().GetWorld().SetDate(reset_year, month, day, hour, minute);
		Print("[Seasons] Year has been reset");
	}
	else
	{
		Print("[Seasons] Year has not reset");
	}

 

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

×