Jump to content

setElementData - Every Second


Recommended Posts

Posted

Would it be laggy to setElementData every second?

I need a way for a number to be updated every second and carried over to another resource, but be bound to a single person if that makes sense.

Posted

Tables are the answer. However, keep in mind that these two are located in two different areas of the application.

If I helped you, please click the like button on the right ;) Thanks!

  • Moderators
Posted
Would it be laggy to setElementData every second?

No it won't, element datas are really powerfull.

By the way, if you want to store the current play time of the player, I would use only one setElementData that will store the result of getTickCount().

Then when you want to know how many seconds the player is in:

local tick = getTickCount() 
local joinTick = getElementData(thePlayer, "joinTick") or 0 
local secondsIn = (tick - joinTick) / 1000 

Do as you would like.

The rEvolution is coming ...

Posted
Would it be laggy to setElementData every second?
No it won't, element datas are really powerfull.

Indeed. The main reason for that is that element data isn't going thru the Lua VM, but the core, so it should be considered as a more native feature. Depends on the usage though, sometimes tables are far better than element data.

If I helped you, please click the like button on the right ;) Thanks!

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