Jump to content

Day/Night Time


Backtrack

Recommended Posts

How can is set uo the day/night time

 

sub set_time {
    my ($s, $m, $h, $day, $mon, $y) = localtime(time() - 3*3600);
    $y += 1900;
    $mon++;
    
    # Uncomment to disabe night
    #($h, $m) = (17, 0) if ($h > 17 || ($h >= 0 && $h < 4));
    
    my $file = PATH.'cache/set_time.sqf';
    open (IN, ">$file") or die "Can't find $file";
    # ["PASS", [year, month, day, hour, minute]]
    print IN '["PASS",[2012,6,6,'.$h.','.$m.']]'; # with full moon
    close (IN);
}

 

i want to have only 4 Hours 2 hours Day 2 Hours Night

Link to comment
Share on other sites

    # Uncomment to disabe night

    #($h, $m) = (17, 0) if ($h > 17 || ($h >= 0 && $h < 4));

  

 

I believe if you change it too

 

    # Uncomment to disabe night

    #($h, $m) = (4, 0) if ($h > 4 || ($h >= 0 && $h < 4));

Link to comment
Share on other sites

($h, $m) = (17, 0) if ($h > 17 || ($h >= 0 && $h < 4));

 

Isn't the logic; Set the game time to 17:00 if the actual time is after 17:00 or the actual time is after midnight but before 04:00    or in English, set the game time to 17:00 if the actual time is between 17:00 and 04:00.

 

so the logic for ($h, $m) = (4, 0) if ($h > 4 || ($h >= 0 && $h < 4)); Set the game time to 04:00 if the actual time is after 04:00 or the actual time is between 00:00  and 04:00 ... Always set the game time to 04:00

 

This only applies at startup so if you were to start your server at 20:00 the game time is set to 17:00 and rolls forwards so that at 08:00 actual, in game time is 05:00, days are still 24Hrs long.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...