Emit - server

Use emit function when you want to trigger an event from the server to the server.
You need to declare the event on the server with on or onNet first.

Signature

function emit(eventName: string, ...args?: any ) => void

Required argument

  • eventName: The event name you want to trigger.

Optional arguments

  • …args: The arguments you want to pass.

Examples

// No arg
emit("foo:playerIsHere");

// With args
emit("foo:thisPlayerIsHere", playerId, playerLicense);