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


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


alt.once('someEvent', someCallbackFunction);

Real World Example

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

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

results matching ""

    No results matching ""