NEW! Servers for GTA V (FiveM).. Use Coupon SPOOK, take 20% off Click here to order now at SurvivalServers.com

Difference between revisions of "Custom Ingame Server Time"

From Survival Servers
Jump to navigation Jump to search
(Created page with "With the release of DayZ Standalone there have been some requests out there to enable server owners to keep the time of day on their server set to certain point. For example s...")
 
 
Line 6: Line 6:
 
   <li>Log into your FTP client. (Info here for [https://survivalservers.com/wiki/index.php?title=FTP_Access FTP])</li>
 
   <li>Log into your FTP client. (Info here for [https://survivalservers.com/wiki/index.php?title=FTP_Access FTP])</li>
 
   <li>Head into the following directory: <b>/MPmissions/dayzOffline.chernarusplus</b></li>
 
   <li>Head into the following directory: <b>/MPmissions/dayzOffline.chernarusplus</b></li>
   <li>Next download a copy of the Capps' Custom DayZ SA Time. You can get a copy of the <b>"Scripts"</b> folder from [https://github.com/Capps0611/Custom-DayZ-Standalone-Time/releases/download/v0.0.1/Scripts.zip GitHub]</li>
+
   <li>Next download a copy of the Capps' Custom DayZ SA Time. You can get a copy of the <b>"Scripts"</b> folder from [https://github.com/Capps0611/Custom-DayZ-Standalone-Time/releases/download/v0.0.2/Scripts.zip GitHub]</li>
 
   <li>Exact the <b>"Scripts"</b> folder into your <b>MPMissions\dayzOffline.chernarusplus directory</b></li>
 
   <li>Exact the <b>"Scripts"</b> folder into your <b>MPMissions\dayzOffline.chernarusplus directory</b></li>
 
   <li>Open your Init.c file</li>
 
   <li>Open your Init.c file</li>

Latest revision as of 05:43, 4 March 2019

With the release of DayZ Standalone there have been some requests out there to enable server owners to keep the time of day on their server set to certain point. For example some may want their server to always remain in daylight and others might want eternal darkness. So with that, This page will help you install a small server side script to do just that! Lets dive right into it!

Installation

  1. Bring down the server by hitting stop on the panel
  2. Log into your FTP client. (Info here for FTP)
  3. Head into the following directory: /MPmissions/dayzOffline.chernarusplus
  4. Next download a copy of the Capps' Custom DayZ SA Time. You can get a copy of the "Scripts" folder from GitHub
  5. Exact the "Scripts" folder into your MPMissions\dayzOffline.chernarusplus directory
  6. Open your Init.c file
  7. At the top of the Init.c file add directly above void main()
  8.    #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\Scripts\\cappsTimeLoop.c"  
       int setStartHour = 10;   
       int setStopHour = 16; 
     
  9. To configure the script you will want to adjust the startHour and stopHour. To get an idea, 0 is 12:00am and 23 is 11:00pm
  10. Next inside of the void main() at the very bottom, you will want to add
  11.   cappsTimeLoop(setStartHour,setStopHour,true);
      
  12. Next scoll down to just underneath override void StartingEquipSetup(PlayerBase player, bool clothesChosen) inside of the class CustomMission: MissionServer:
  13. You are going to add the following code:
  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;
    		}
    	}
    


Share your opinion