Skip to main content

Globals::waitAsync

Client-side function

An asynchronous function that pauses execution of your current script.

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;
}