SycroX Posted July 20, 2017 Share Posted July 20, 2017 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
Simi23 Posted July 20, 2017 Share Posted July 20, 2017 Is your timezone set to what you want? Link to comment
pa3ck Posted July 20, 2017 Share Posted July 20, 2017 Is it running on a hosted server or on your own local machine? Link to comment
SycroX Posted July 20, 2017 Author Share Posted July 20, 2017 (edited) hosted server Edited July 20, 2017 by #x1AhMeD,-09 Link to comment
pa3ck Posted July 20, 2017 Share Posted July 20, 2017 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
pa3ck Posted July 20, 2017 Share Posted July 20, 2017 I just looked at getRealTime(), there's a parameter called "local timezone", try to set it to true to see if that works for you: https://wiki.multitheftauto.com/wiki/GetRealTime Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now