Jump to content

time (computer)


iam2noob4u

Recommended Posts

Use getRealTime

function showtime () 
  
        local time = getRealTime() 
        local hours = time.hour 
        local minutes = time.minute 
        outputChatBox ( "Local Time: "..hours..":"..minutes ) 
end 

Link to post
How do I get these Real Time at the place where the ingame time stand?

You mean setting the ingame time to the same time as the real time?

Use setTime, see wiki for details.

If you want it to run at the same speed like the real time does, you probably need a clientside script that inside the onClientRender event forces the game time to equal the real time.

  
function onRender () 
        local time = getRealTime() 
        local hours = time.hour 
        local minutes = time.minute 
  
        setTime ( time.hour, time.minute ) 
end 
  
addEventHandler ( "onClientRender", getRootElement (), onRender ) 
  

This will set the GTA time to the real time every frame so it can't go any faster. Not sure if it'll create some flickering though on weather or the clock display.

Link to post

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