Jump to content

Event question


myjobisgop

Recommended Posts

Posted

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?

Posted

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

Posted

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'

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