Army@1 Posted December 23, 2015 Share Posted December 23, 2015 Hello everyone. I have made a script to synchronize player time with server time but the script is spamming the debugscript with an error whenever I reconnect the server. Error: Server triggered clientside event syncTime, but event is not added client side. It is probably because server script started before client or there are no players in the server. So far I have tried setting a timer and checking number of players in server but no luck. Anyone can please help me in this? Client:- addEvent("syncTime", true) addEventHandler("syncTime", getRootElement(), function(h, m) local hc, mc = getTime() if hc ~= h or mc ~= m then setTime(h, m) end end ) Server:- setTimer( function() local h, m = getTime() if #getElementsByType("player") >= 1 then triggerClientEvent("syncTime", getRootElement(), h, m) end end, 1000, 0) Link to comment
draobrehtom Posted December 23, 2015 Share Posted December 23, 2015 https://forum.multitheftauto.com/viewtopic.php?f=91&t=33976 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