alt.emit will emit an event across multiple resources or a single resource.

An event being a similar to calling a function by the name given in its first parameter.

An emit event can only be recieved if there is an on event paired with a similar name.

Any amount of parameters or variables may be passed through an emit event.


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


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


alt.on('customEventName', (arg1, arg2) => {
    console.log(`${arg1} ${arg2}`);
    // Prints 'hello world'

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

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

results matching ""

    No results matching ""