Jump to content

How to pass server Timer to client ?


Fist

Recommended Posts

Posted

As title says, how can i pass timer that has been created on server side to the client? I tried doing with setElementData(element,"timer",timer) as it is synced between server and client but when i tried to get timer with getElementData(element,"timer") on client it returned nothing but when i try it on server side, all works. Any solutions?

Posted (edited)
23 minutes ago, NeXuS™ said:

What do you need the timer for?

To get how much time is left in timer to show it on screen for client and timer is being used on server side to tell when end Round.

Edited by Fist
Posted (edited)

Easily, you could trigger a starting function to the client side whenever the round starts with an integer as an argument which represents the length of the round. After, you can use getTickCount to calculate the remaning time.

Edited by NeXuS™
Posted
25 minutes ago, NeXuS™ said:

Easily, you could trigger a starting function to the client side whenever the round starts with an integer as an argument which represents the length of the round. After, you can use getTickCount to calculate the remaning time.

no need for getTickCount, there is function to get remaining time and other info about timer with getTimerDetails. + i already did that, but i thought it was possible to do this way and then code looks way cleaner which i like more but looks like it's not possible.

1 hour ago, ZoRRoM said:

Where is element defined?

 

You must use resourceRoot.


setElementData(resourceRoot,...)

 

what? Why resourceRoot? I created element dummy that i use to sync data between client and server when i need to.

  • 2 months later...
Posted (edited)

I'm having the same problem. I have no idea how to sync a server side timer to client side. But I need to check for timer details somehow. Not sure how to do it.

Edited by Backsage
Posted

How about using getTimerDetails, and setting those details in a table in setElementData?

Server timers are different from client sided timers

Client sided timers usually depend on FPS. 

  • Discord Moderators
Posted

btw, just before someone tries to pass table thru setElementData: u cant.

Posted (edited)

Nevermind. Fixed it. I guess I just needed to move some client sided code over to server side. And I didn't need to use element data.

Edited by Backsage

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