Globals::waitAsync
Client-Side Function
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;
}