myjobisgop Posted October 24, 2013 Share Posted October 24, 2013 For example, I trigger client event in server by triggerClientEvent. In client that event cancels. How can I know on the server about that this event has been cancelled on the client? Link to comment
Renkon Posted October 24, 2013 Share Posted October 24, 2013 A possible way to realize that would be to trigger a serverSide Event as a response to that Client event. If after, for instance, two seconds, the event is not triggered (server-sided one), it means it has been canceled. Like: From Server > Client Client responses to server No response? cancelled Link to comment
myjobisgop Posted October 24, 2013 Author Share Posted October 24, 2013 Renkon, How to check that there was no response from the client? Link to comment
Renkon Posted October 24, 2013 Share Posted October 24, 2013 Let's say you trigger to the Client an event called "carEntered", as an example. We can do the following clientside. addEventHandler("carEntered", root, function() -- bunch of code triggerServerEvent("checkEvent", localPlayer) end ) So we trigger a check to the Server. And we can take a look like this: isChecked = false; addEventHandler("checkEvent", root, function() isChecked = true; end) If necessary, after triggering the client event you could create a timer counting 2000 miliseconds to then check if isChecked is true. Do you get what I mean now' Link to comment
Spajk Posted October 24, 2013 Share Posted October 24, 2013 I never tried this function, but I think you should try it: https://wiki.multitheftauto.com/wiki/WasEventCancelled 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