Jump to content

setTime Question


B!ERPuNK

Recommended Posts

Hello everybody,

I am making a RPG script with a friend. To make it a bit more realistic for every player, i want to change the time to the player's clock. Now i have allready got this script:

function setupTime()
local realtime = getRealTime()
setTime(realtime.hour, realtime.minute)
setMinuteDuration(60000)
end
 
addEventHandler("onPlayerJoin", getRootElement(), setupTime)

But when i tested it with someone else (who set a different time on his pc), the time stayed the same for him. Is it possible that getRealTime gets the time from the server? And if possible, can i change it so it will take the time from the player?

So that everyone from different places have a different time.

Sorry for asking but it's been a little while since i scripted for MTA and i've got to pick it up again.

Thanks in advance,

Pim

Link to comment

setTime server-side sets the time for server (so for every player), you'll need to do it client-side for it to be that player only. Simply change "onPlayerJoin" to "onClientResourceStart" and in meta.xml set the script type to "client".

Link to comment
setTime server-side sets the time for server (so for every player), you'll need to do it client-side for it to be that player only. Simply change "onPlayerJoin" to "onClientResourceStart" and in meta.xml set the script type to "client".

Thanks, it totally works!

Thanks again ;) !

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