alt.once

Subscribes to a server event with specified listener, which only triggers once. Once the event is triggered it can never be triggered again.

Declaration

alt.once<K extends keyof IServerEvent>(eventName: K, listener: IServerEvent[K]): void

Usage

alt.once('someEvent', someCallbackFunction);

Real World Example

alt.once('playerDamage', (victim, attacker, damage, weaponHash) => {
    alt.log(`${victim.name} was damaged`);
}

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

results matching ""

    No results matching ""