alt.onceClient
Subscribes to server event with specified listener, which only triggers once. Once the event is triggered it can never be triggered again.
This event specifically is only triggered once from some player on client-side
.
First argument
in the function will always be a Player
.
Declaration
alt.onceClient(eventName: string, listener: (player: Player, ...args: any[]) => void): void
Usage
alt.onceClient('someEvent', someCallbackFunction);
Real World Example
alt.onceClient('someEvent', (player, args) => {
alt.log(args)
}
These examples assume you have imported alt
from alt-server
.