Custom Ingame Server Time

From Survival Servers
Revision as of 12:08, 19 November 2026 by Ryan (talk | contribs) ([wiki:wiki-operator] Fixes from the review of the rewording: claims, example addresses, names and wording (approved by Ryan, Nov 19))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

You can keep the time of day on your DayZ server in a set range of hours. Some owners want daylight all the time, and others want it always dark.

Installation

  1. Stop the server by clicking STOP on the Game Server page in the Command Center.
  2. Log in with an FTP program (FileZilla). How to connect: FTP Access.
  3. Open the /MPmissions/dayzOffline.chernarusplus folder. On Livonia it's dayzOffline.enoch, on Frostline dayzOffline.sakhal and on Badlands dayzOffline.nasdara. Use your map's folder name in the later steps too.
  4. Download Capps' Custom DayZ SA Time: get the "Scripts" folder from GitHub.
  5. Extract the "Scripts" folder into your MPMissions\dayzOffline.chernarusplus folder.
  6. Open your Init.c file
  7. At the top of the Init.c file, add these lines right before void main():
  8.    #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\Scripts\\cappsTimeLoop.c"  
       int setStartHour = 10;   
       int setStopHour = 16; 
     
  9. To set the hours, change setStartHour and setStopHour. 0 is 12:00am and 23 is 11:00pm.
  10. At the very bottom of void main(), add this line:
  11.   cappsTimeLoop(setStartHour,setStopHour,true);
      
  12. Scroll down to right after override void StartingEquipSetup(PlayerBase player, bool clothesChosen) inside class CustomMission: MissionServer.
  13. Add this code there:
  14.  override void TickScheduler (float timeSplice)
    	{
    		GetGame().GetWorld().GetPlayerList(m_Players);
    		if( m_Players.Count() == 0 ) return;
    		for(int i = 0; i < SCHEDULER_PLAYERS_PER_TICK; i++)
    		{
    	     if(m_currentPlayer >= m_Players.Count() )
    	     {
    	        m_currentPlayer = 0;
    	     }
    	     PlayerBase currentPlayer = PlayerBase.Cast(m_Players.Get(m_currentPlayer));
    	     currentPlayer.OnTick();
    	     m_currentPlayer++;
    
    	   }
    		//Ignore above code that is required to keep food,drink and other survival elements working
    
    		int currentTime = GetGame().GetTime() * 0.001;
    		static int newTime = 0;
    		int timeDelay = 180;
    		if (currentTime >= newTime + timeDelay)
    		{
    			//GetGame().ChatPlayer(1,"3 minute check on reset!");//for debug pruposes
    			cappsTimeLoop(setStartHour,setStopHour,false);
    			//GetGame().ChatPlayer(1,"Passed the time switch call");//for debug pruposes
    			newTime = currentTime;
    		}
    	}
    

Rent a DayZ server from Survival Servers with instant setup.