roaddog Posted April 13, 2016 Share Posted April 13, 2016 Any idea can we make timer in serverside then send it to clientside as a timer? timer = setTimer(..., 5000, 1) triggerClientEvent(el, "timerClient", el) addEvent("timerClient", true) addEventHandler("timerClient", root, function() timer = setTimer(..., 5000, 1) end) this was my attempt but I need a better synced one Link to comment
Shido Posted April 13, 2016 Share Posted April 13, 2016 Its not actually "send" the timer (i dont know if it is even possible), but you can use arguments to make the client call variables that were defined server-side. There's no point on creating a new timer server-side since it will be totally different from the one on client-side and you will just call the function twice (once on client and once on server). -- Client-side -- addEvent("timerClient", true) addEventHandler("timerClient", root, function(arguments) timer = setTimer(functionName, 5000, 1,arguments) end) -- Server-side -- function startTimer() arguments = something triggerClientEvent("timerClient",source,arguments) end Of course you have to define the variables and trigger the event on the same server-side function. Link to comment
roaddog Posted April 13, 2016 Author Share Posted April 13, 2016 You just gave me a light. Im gonna do is setTimer in clienside only then call it twice. Thank you. 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