Streaming::requestRuntimeAssetFromUrl

From RAGE Multiplayer Wiki
Revision as of 17:46, 16 March 2025 by Shr0x (talk | contribs) (Created page with "{{ClientsideJsFunction}} {{JSContainer| ===Required Params=== *'''resourceName:''' {{RageType|string}} — The name of the resource. *'''url:''' {{RageType|string}} — The URL from which to request the asset. ===Return value=== *'''{{RageType|Promise<boolean>}}''' — Resolves to `true` if the asset was successfully loaded, otherwise `false`. ==Syntax== <syntaxhighlight lang="javascript"> mp.game.streaming.requestRuntimeAssetFromUrl(string resourceName, string url) <...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Client-Side
Function

 JavaScript



JavaScript Syntax


Required Params

  • resourceName: string — The name of the resource.
  • url: string — The URL from which to request the asset.

Return value

  • 'Promise<boolean>' — Resolves to `true` if the asset was successfully loaded, otherwise `false`.

Syntax

mp.game.streaming.requestRuntimeAssetFromUrl(string resourceName, string url)

Example

mp.game.streaming.requestRuntimeAssetFromUrl("myAsset", "https://example.com/asset.ytd")
    .then(success => {
        if (success) {
            mp.gui.chat.push("Asset successfully loaded.");
        } else {
            mp.gui.chat.push("Failed to load asset.");
        }
    });


See also