Globals::waitAsync

From RAGE Multiplayer Wiki
Revision as of 04:30, 18 August 2020 by MrPancakers2 (talk | contribs) (Created page with "__NOTOC__ {{ClientsideJsFunction}} An asynchronous function that pauses execution of your current script. {{JSContainer| == Syntax == <pre> mp.game.wait(ms); </pre> === Par...")
(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.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);


See Also