emitToPlayer
Emit an event to a specific player on the server.
Syntax
engine.network.emitToPlayer(player, event, data);
Parameters
Name | Type | Description |
---|---|---|
player | PlayerManager or number | The player manger or player ID. |
event | string | The event name to emit. |
data (optional) | NetworkEventData | The event data. |
Example
// with player manager
engine.network.emitToPlayer(player, 'onOpenDoor', {
doorId: 1,
status: true,
});
// with player id
engine.network.emitToPlayer(1, 'onOpenDoor', {
doorId: 1,
status: true,
});
Available on: Client Server