Jump to content

Real Time Clock


Link2012

Recommended Posts

Posted

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 =/

Posted (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 by Guest
Posted

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 :D

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