natives.getTexture: Difference between revisions

From GTA Connected
Jump to navigation Jump to search
(Created page with "{{ScriptItem |endpoint = client |games = iv |type = function |name = natives.getTexture |parameters = int txdId, string textureName |parameter1 = int txdId Handle ID of a previously loaded TXD |parameter2 = string textureName Name of the texture inside the TXD |usage = Retrieves a texture handle from a loaded TXD by name |notes = The TXD must be loaded first using natives.loadTxd; the returned texture can be drawn with natives.drawSprite |return1 = object Texture...")
 
(No difference)

Latest revision as of 00:34, 28 November 2025

Function Client Only icon-iv.png Online and Offline

Available since Client 1.0.0

object natives.getTexture(int txdId, string textureName)

The natives.getTexture function is used to Retrieves a texture handle from a loaded TXD by name.

Parameters

1) int txdId Handle ID of a previously loaded TXD.
2) string textureName Name of the texture inside the TXD.

Return

object Texture handle.

Notes

Examples

Example 1 - JavaScript:

addEventHandler("OnDrawnHUD", function() {

   const txdId = natives.loadTxd("frontend_360");
   const neonTex = natives.getTexture(txdId, "neon");
   if (neonTex) {
       // Draw the neon texture centered on screen
       natives.drawSprite(neonTex, 0.5, 0.5, 0.3, 0.2, 0, 255, 255, 255, 255);
   }

});

Compatibility

There isn't any compatibility information for this function.