natives.getTexture: Difference between revisions
Jump to navigation
Jump to search
ChrisGame20 (talk | contribs) (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 ![]()
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
- The TXD must be loaded first using natives.loadTxd; the returned texture can be drawn with natives.drawSprite.
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.