Jump to content

getrealtime


fairyoggy

Recommended Posts

I have script for get real time:

local minuteDelay = get ("realtime.minuteDelay")
setMinuteDuration (minuteDelay)

local hour = get ("realtime.initialHour")
local minute = get ("realtime.initialMinute")

function servetime ()
  servertime = getRealTime ()
  hours = (servertime.hour) 
  minutes = string.format("%02d", servertime.minute)
  second = string.format("%02d", servertime.second)
end
setTimer (servetime, 1000, 0)

local function onJoin()

	spawn(source)
	setTime (hours,minutes)
end

setting for this in meta:

<settings>
		<setting name="*initialHour" value="0" friendlyname="Initial Hour" accept="0-23" desc="The hour that the game inits with when starting this resource." />
		<setting name="*initialMinute" value="0" friendlyname="Initial Minute" accept="0-60" desc="The minute that the game inits with when starting this resource." />
		<setting name="*minuteDelay" value="60000" friendlyname="Minute Delay" accept="0-9999000" desc="How much time does minutes delay its advance in miliseconds."  />
	</settings>

I got what I wanted, but there is a problem with the seconds. 

Example: you start server in 11:33:55 and when in real time there will be 11:34:00 , will be on the server 11:33:05

It is necessary that the server would be the same (11:33:55 not 11:33:00)

How to fix it?

Edited by slapz0r
Link to comment

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...