natives.getTextureFromStreamedTxd

From GTA Connected
Jump to navigation Jump to search

Function Client Only icon-iv.png Online and Offline

Available since Client 1.0.0

object natives.getTextureFromStreamedTxd(string txdName, string textureName)

The natives.getTextureFromStreamedTxd function is used to Retrieves a texture handle from a streamed TXD by name.

Parameters

1) string txdName Name of the streamed TXD previously requested.
2) string textureName Name of the texture inside the streamed TXD.

Return

object Texture handle.

Notes

  • - Requires that the TXD has been requested with natives.requestStreamedTxd- Allows accessing textures that are **not limited to the core texture folder**, since streamed TXDs can come from other game assets.

Examples

Example 1 - JavaScript:

addEventHandler("OnDrawnHUD", function() {

   // Request and then get a texture from a streamed TXD
   natives.requestStreamedTxd("w_glock", true);
   const tex = natives.getTextureFromStreamedTxd("w_glock", "icon");
   if (tex) {
       natives.drawSprite(tex, 0.5, 0.5, 0.1, 0.1, 0, 255, 255, 255, 255);
   }

});

Compatibility

There isn't any compatibility information for this function.