Link2012 Posted December 13, 2012 Share Posted December 13, 2012 How to implement a real time clock? I tried: setTimer(function() local real = getRealTime() setTime(real.hour, real.minute) end, 500, 0) But the sky starts flickering =/ Link to comment
manve1 Posted December 13, 2012 Share Posted December 13, 2012 (edited) thats because real.minute is not defined try: function syncTime() local realTime = getRealTime() local hour = realTime.hour local minute = realTime.minute setMinuteDuration ( 60000 ) setTime( hour , minute ) end setTimer ( syncTime, 500, 1 ) setTimer ( syncTime, 3000000, 0 ) Edited December 13, 2012 by Guest Link to comment
Link2012 Posted December 13, 2012 Author Share Posted December 13, 2012 (edited) It IS defined https://wiki.multitheftauto.com/wiki/GetRealTime EDIT: kay, you edited the post when I was posting this stuff, let me try what you've posted EDIT 2: Okay, works, thanks... But real.minute IS defined Edited December 13, 2012 by Guest Link to comment
manve1 Posted December 13, 2012 Share Posted December 13, 2012 In ur script its not defined, look at edit tho Link to comment
Link2012 Posted December 13, 2012 Author Share Posted December 13, 2012 But there's no real difference in doing local minute = real.minute doStuff(minute) and doStuff(real.minute) Can't see the point Link to comment
manve1 Posted December 13, 2012 Share Posted December 13, 2012 just try the code i posted, and tell me if it worked Link to comment
Link2012 Posted December 13, 2012 Author Share Posted December 13, 2012 Yeah, it works, see my second edit on my second post Link to comment
manve1 Posted December 13, 2012 Share Posted December 13, 2012 Btw, i don't take the credit for this script, i only copied from one resource of mta community (( can't find the web link now )), but happy to hear that it works p.s. If it is defined, i don't care 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