Atti Posted February 6, 2008 Share Posted February 6, 2008 Can I sync a variable between server and client? i.e. i want to create a server-side timer with a variable that is passed to my client-side script, where it's used for a GUI. So --server side: on start -> var=500 every second -> var=var-1 --client side: every second -> print(tostring(var)) Actually with this code i get "nil" client-side. How can I do? Link to comment
tma Posted February 6, 2008 Share Posted February 6, 2008 I usually just start a game round by using triggerClientEvent() and passing any variables the client needs (round duration etc.) to a client-side event which I've made e.g. "startRace" Link to comment
Atti Posted February 6, 2008 Author Share Posted February 6, 2008 Yeah, solved. TriggerClientEvent() can do the sync that i want. Link to comment
norby89 Posted February 6, 2008 Share Posted February 6, 2008 element data is also synced ( setElementData / getElementData ) PS) you shouldn't send data too often tho and for long periods of time, it's bandwith consuming Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now