Skip to main content

onPlayerEvent

Register a listener function to be called when a player event is emitted.

Syntax

engine.network.onPlayerEvent(event, listener);

Parameters

NameTypeDescription
eventstringThe event name to subscribe.
listener(player: PlayerManager, data?: NetworkEventData) => voidThe listener.

Returns

  • listener - The listener.

Example

engine.network.onPlayerEvent('onSayWelcome', player => {
engine.localPlayer.sendMessage(`${player.name} says: Welcome!`);
});

Available on: Client Server