WeaponClient

setCanPedSelectInventoryWeapon

SET_CAN_PED_SELECT_INVENTORY_WEAPON0xB4771B9AAF4E68E4

The GTA V native SET_CAN_PED_SELECT_INVENTORY_WEAPON of the WEAPON namespace, as LS:MP client scripts call it: the global function setCanPedSelectInventoryWeapon, in JavaScript and in Lua.

SignatureJavaScript
setCanPedSelectInventoryWeapon(
  ped: Ped,
  weaponHash: Hash,
  toggle: boolean
): void
SignatureLua
setCanPedSelectInventoryWeapon(ped: Ped, weaponHash: Hash, toggle: boolean)

Usage

JavaScript
setCanPedSelectInventoryWeapon(ped, weaponHash, toggle);
Lua
setCanPedSelectInventoryWeapon(ped, weaponHash, toggle)

Parameters

ParameterTypeJavaScriptLua
pedPednumberinteger
weaponHashHashnumberinteger
toggleBOOLbooleanboolean

Returns

Nothing. In JavaScript the call evaluates to undefined.

Notes

From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.

Disables selecting the given weapon. Ped isn't forced to put the gun away. However you can't reselect the weapon if you holster then unholster. Weapon is also grayed out on the weapon wheel.
Full list of weapons by DurtyFree: https://github.com/DurtyFree/gta-v-data-dumps/blob/master/weapons.json

Reference

Namespace
Weapon WEAPON
In the game
void SET_CAN_PED_SELECT_INVENTORY_WEAPON(Ped ped, Hash weaponHash, BOOL toggle)
Hash
0xB4771B9AAF4E68E4
Introduced
Game build 1103 legacy numbering
Formerly
_SET_CAN_PED_SELECT_WEAPON _SET_CAN_PED_EQUIP_WEAPON

Open in the interactive natives reference