alt.on

Used to stop listening to built-in events when a player joins, leaves, enters a vehicle, dies, etc. or custom events.

See the server event list for additional examples.

Declaration

alt.off(eventName: string, listener: (...args: any[]) => void): void

Usage

alt.off('someEventName', someCallbackFunction);

Real World Example

This example shows that an event will automatically turn itself off after the first call.

function someCallbackFunction() {
    alt.off('someEventName', someCallbackFunction);
}

alt.on('someEventName', someCallbackFunction);

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

results matching ""

    No results matching ""