natives.requestScript

From GTA Connected
Revision as of 16:42, 28 November 2025 by ChrisGame20 (talk | contribs) (Created page with "{{ScriptItem |endpoint = client |games = iv |type = function |name = natives.requestScript |parameters = string scriptName |parameter1 = string scriptName Name of the script to request |usage = Requests a script to be loaded into memory so it can be started later |notes = - Must be called before natives.startNewScript to ensure the script is available - If the script does not exist, the request will silently fail |return1 = void |returnFail1 = void |exampleJS = bind...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function Client Only icon-iv.png Online and Offline

Available since Client 1.0.0

void natives.requestScript(string scriptName)

The natives.requestScript function is used to Requests a script to be loaded into memory so it can be started later.

Parameters

1) string scriptName Name of the script to request.

Return

void This function doesn't return a value.

Notes

  • - Must be called before natives.startNewScript to ensure the script is available- If the script does not exist, the request will silently fail.

Examples

Example 1 - JavaScript:

bindEventHandler("OnResourceReady", thisResource, function() {

   // Request the "trafficControl" script
   natives.requestScript("trafficControl");

});

Compatibility

There isn't any compatibility information for this function.