Used to emit an event that the server will receive. The client is responsible for triggering this event based on whatever criteria is written.


alt.emitServer(eventName: string, ...args: any[]): void


alt.emitServer('customEventName', 'hello', 'world');


alt.emitServer('customEventName', 'hello', 'world');

Retrieving the Event on Server Side

When an emitServer is sent from the player the server-side can retrieve this event by using the onClient function from alt.

Example being...

alt.onClient('customEventName', (player, arg1, arg2, etc) => {
    console.log(arg1); // Prints 'hello' from the above example.

These examples assume you have imported alt from alt-client.

results matching ""

    No results matching ""