Globals::waitAsync

From RAGE Multiplayer Wiki
Revision as of 06:37, 18 August 2020 by Rootcause (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Client-Side
Function

 JavaScript



An asynchronous function that pauses execution of your current script.

JavaScript Syntax

Syntax

mp.game.waitAsync(ms);

Parameters

  • ms: Int

Examples

Requests the specified scaleform, waits until it is loaded then returns the scaleform handle.

Client-Side
async function requestScaleform(scaleformName) {
    const handle = mp.game.graphics.requestScaleformMovie(scaleformName);

    while (!mp.game.graphics.hasScaleformMovieLoaded(handle)) {
        await mp.game.waitAsync(0);
    }

    return handle;
}


See Also