WeaponClient

hasPedGotWeaponComponent

HAS_PED_GOT_WEAPON_COMPONENT0xC593212475FAE340

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

SignatureJavaScript
hasPedGotWeaponComponent(
  ped: Ped,
  weaponHash: Hash,
  componentHash: Hash
): boolean
SignatureLua
hasPedGotWeaponComponent(
  ped: Ped,
  weaponHash: Hash,
  componentHash: Hash
): boolean

Usage

JavaScript
const result = hasPedGotWeaponComponent(ped, weaponHash, componentHash);
Lua
local result = hasPedGotWeaponComponent(ped, weaponHash, componentHash)

Parameters

ParameterTypeJavaScriptLua
pedPednumberinteger
weaponHashHashnumberinteger
componentHashHashnumberinteger

Returns

BOOL JavaScript boolean, Lua boolean

Notes

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

Full list of weapons & components by DurtyFree: https://github.com/DurtyFree/gta-v-data-dumps/blob/master/weapons.json

Reference

Namespace
Weapon WEAPON
In the game
BOOL HAS_PED_GOT_WEAPON_COMPONENT(Ped ped, Hash weaponHash, Hash componentHash)
Hash
0xC593212475FAE340

Open in the interactive natives reference