alt.onceServer
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 something on server-side
.
Basically called when you execute alt.emitClient
.
Declaration
alt.onceServer(eventName: string, listener: (...args: any[]) => void): void
Usage
alt.onceServer('someEvent', someCallbackFunction);
Real World Example
alt.onceServer('someEvent', (player, args) => {
alt.log(args)
}
These examples assume you have imported alt
from alt-client
.