Globals::waitAsync
Client-Side Function
An asynchronous function that pauses execution of your current script.
JavaScript Syntax
Syntax
mp.game.wait(ms);
Parameters
- ms: Int
Examples
Pauses the script for 10ms before checking again if ped.handle is still 0 or not and unfreezes the ped when it's created with a valid handle.
let ped = mp.peds.new(); while (ped.handle === 0) await mp.game.waitAsync(0); ped.freezePosition(false);