Jump to content

Call a function after few days


WhoAmI

Recommended Posts

Hy WhoAmI,

sure, you can save the starting timestamp in a variable and check with a Timer (every Minute or if possible every hour) if the new timestamp is higher or equal to the starting timestamp+24h.

Or you can save the timestamp + 24h in the variable and check against this.

getRealTime() 
setTimer() 

Link to comment
Would probably be more optimal to assign the timer on resource start and let it execute with 24 hours delay.
setTimer(function, 1000*60*60*24, 0) 

And restarting the script 1 minute before 24 hours will give the player another 24 hours.

It's better you use an SQL database. Link

Link to comment

Yeah like "getRealTime()", start the timer, and when the resource stops, set the account data for the time it was stopped. Then when the resource starts again it could "getRealTime()" and add account data for the time it started again and calculate the difference between the stopped and started time. Would need a bit of math, but I'm sure it's possible.

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