Skip to main content

offPlayerEvent

Unregister a listener function previously registered with onPlayerEvent.

Syntax

engine.network.offPlayerEvent(event, listener);

Parameters

NameTypeDescription
eventstringThe event name to unsubscribe.
listener(player: PlayerManager, data?: NetworkEventData) => voidThe listener to remove from the event subscription.

Example

// subscribe
const listener = engine.network.offPlayerEvent('onSayWelcome', player => {
// ...
});

// unsubscribe
engine.network.offPlayerEvent('onSayWelcome', listener);

Available on: Client Server