alt.setInterval

Used to create a timer that will trigger a function every x amount of milliseconds. In the usage example the function is being triggered every 5000ms.

The callback function is not immediately invoked. Meaning you have to wait x amount of milliseconds for the first call of the function.

Returns a number reference which can be used to clear the interval.

Declaration

alt.setInterval(handler: (...args: any[]) => void, miliseconds: number): number

Usage

alt.setInterval(someCallbackFunction, 5000);

Real World Example

function someCallbackFunction() {
     alt.log('Timer Says Hello!');
}

alt.setInterval(someCallbackFunction);

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

results matching ""

    No results matching ""