Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
Monsada

how to propagate event on a local machine

Recommended Posts

Hi,

I need to raise an event on server that does each local machine execute an script when event is raised.

How can I do it without cba?

Share this post


Link to post
Share on other sites

Define a global variable on the server that says the event has not happened:

if {!isServer} exithWith {};
MON_myEvent = false;

Also add a public variable event handler to the clients the look for changes to

MON_myEvent.

if {isServer} exithWith {};
"MON_myEvent" addPublicVariableEventHandler {...};

Instead of the ... insert whatever code you want to run.

When the event happens change MON_myEvent to true and use the publicVariable command to broadcast it to the clients:

MON_myEvent = true;
publicVariable "MON_myEvent";

When broadcasted, the event handler will trigger and run the code only on the clients.

Checkout addPublicVariableEventHandler on the biki for arguments and other aspects.

Edited by Loyalguard
remove Double-copy

Share this post


Link to post
Share on other sites
Sign in to follow this  

×