Streaming::requestAnimDictAsync

From RAGE Multiplayer Wiki
Revision as of 18:12, 25 December 2024 by Shr0x (talk | contribs) (Created page with "{{ClientsideJsFunction}} {{JSContainer| === Summary === Requests an animation dictionary asynchronously, resolving when it is loaded or rejecting on timeout. === Syntax === <syntaxhighlight lang="javascript"> mp.game.streaming.requestAnimDictAsync(name, timeout = 5000); </syntaxhighlight> === Required Parameters === * '''name:''' {{RageType|string}} - The name of the animation dictionary to load. * '''timeout:''' {{RageType|number}} - Optional. Timeout in milliseconds...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Client-Side
Function

 JavaScript



JavaScript Syntax


Summary

Requests an animation dictionary asynchronously, resolving when it is loaded or rejecting on timeout.

Syntax

mp.game.streaming.requestAnimDictAsync(name, timeout = 5000);

Required Parameters

  • name: string - The name of the animation dictionary to load.
  • timeout: number - Optional. Timeout in milliseconds (default: 5000).

Return Value

  • 'Promise<bool>' - Resolves to `true` if the animation dictionary is loaded, or `false` if it times out.

Example

mp.game.streaming.requestAnimDictAsync("anim@heists@ornate_bank@hostages@hit").then(success => {
    if (success) {
        mp.gui.chat.push("Animation dictionary loaded!");
    } else {
        mp.gui.chat.push("Failed to load animation dictionary.");
    }
});


See Also