natives.getHashKey

From GTA Connected
Jump to navigation Jump to search

Function Client Only icon-iv.png Online and Offline

Available since Client 1.0.0

int natives.getHashKey(string name)

The natives.getHashKey function is used to Returns the hash key of a given string, typically used for models, animations, or other resources.

Parameters

1) string name The model or resource name to convert into a hash key ("M_Y_COP").

Return

int The hash key corresponding to the given string.

Notes

  • - Commonly used before natives.requestModel to obtain the model hash- Works with ped names, vehicle names, and other resource identifiers.

Examples

Example 1 - JavaScript:

const hash = natives.getHashKey("M_Y_COP"); natives.requestModel(hash); if (natives.hasModelLoaded(hash)) {

   const ped = natives.createChar(1, hash, localPlayer.position, true);

}

Compatibility

There isn't any compatibility information for this function.

Related

Client Related

icon-iii.png icon-vc.png icon-sa.png icon-iv.png bindKey
icon-iii.png icon-vc.png icon-sa.png icon-iv.png isKeyDown
icon-iii.png icon-vc.png icon-sa.png icon-iv.png isScancodePressed
icon-iii.png icon-vc.png icon-sa.png icon-iv.png unbindAllKeys
icon-iii.png icon-vc.png icon-sa.png icon-iv.png unbindKey