Notice: Failed to invoke Pygments: [Called from MediaWiki\SyntaxHighlight\SyntaxHighlight::highlightInner in /home/pi/www/gtac/wiki/wiki/extensions/SyntaxHighlight_GeSHi/includes/SyntaxHighlight.php at line 334] in /home/pi/www/gtac/wiki/wiki/includes/debug/MWDebug.php on line 507

Notice: Failed to invoke Pygments: [Called from MediaWiki\SyntaxHighlight\SyntaxHighlight::highlightInner in /home/pi/www/gtac/wiki/wiki/extensions/SyntaxHighlight_GeSHi/includes/SyntaxHighlight.php at line 334] in /home/pi/www/gtac/wiki/wiki/includes/debug/MWDebug.php on line 507
natives.hasScriptLoaded - GTA Connected

natives.hasScriptLoaded

Function Client Only icon-iv.png Online and Offline

Available since Client 1.0.0
bool natives.hasScriptLoaded(string scriptName)
The natives.hasScriptLoaded function is used to Checks if a requested script has finished loading into memory.

Parameters

1) string scriptName Name of the script to check.

Return

bool True if the script is loaded.

Notes

Examples

Example 1 - JavaScript:

bindEventHandler("OnResourceReady", thisResource, function() {
    // Request and check script
    natives.requestScript("trafficControl");
    if (natives.hasScriptLoaded("trafficControl")) {
        natives.startNewScript("trafficControl", 1024);
        console.log("trafficControl script started successfully.");
    } else {
        console.log("Script trafficControl is not yet loaded.");
    }
});

Compatibility

There isn't any compatibility information for this function.