Jump to content

[Problem]getRealTime


SycroX

Recommended Posts

i'v a problem with getRealTime function i'm trying to use it in server side to get the time in hours but when i output it in chatbox   it's give me a wrong time ..

setTimer(
function()
	local time = getRealTime()
	local hour = time.hour
	for _,player in ipairs(getElementsByType("player")) do
		if getPlayerSerial(player) == "AE29580EE667085A8A8DC0CEE2E53BE4" then
			outputChatBox(tostring(time.hour), player)
		end
	end
	if hour >= 17 and hour < 20 then
      	outputChatBox("true", root)
    else
      	outputChatBox("false", root)
	end
end, 1000, 0)

 

Link to comment

That is why you are getting different results, the server is probably in a different timezone. If it's a VPS you're renting yourself, you can just change the timezone, if it's a game server you're renting, you'd need to manually add/remove hours every single time you use the getRealTime function.

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...