Jump to content

timer for setAccountData


fairyoggy

Recommended Posts

Posted

For example, an account has a value:

setAccountData (acc, "time", "10" )

How to make a timer on the server, by which in a minute this value will be "9" and after another 9 minutes it will become "0"

 

Account must be offline

  • Moderators
Posted
6 hours ago, slapz0r said:

How to make a timer on the server

The data type time in your database is not something you should animate.

https://wiki.multitheftauto.com/wiki/GetRealTime

Create your end time:  (seconds)

> End time (start time + duration)

That is all you have to save.

 

Remaining time =  (End time - current time)

 

 

 

 

 

 

 

 

  • 2 weeks later...
Posted

@IIYAMA Can you give me example in code? I can’t understand how to use it correctly.

I could only get this but how can i use it in my goal ?

local time = getRealTime()
	local hours = time.hour
	local minutes = time.minute
	local seconds = time.second
	local duration = 10
	local endtime = seconds + duration
	local curtime = hours..":"..minutes..":"..seconds
	local remaintime = endtime - curtime
	

 

  • Moderators
Posted
4 hours ago, slapz0r said:

I could only get this but how can i use it in my goal ?

Use timestamp. Check the docs.

 

And no I currently can't give any examples as I am extremely busy with a real life project that is killing all the hours I have. Please ask somebody else.

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