WeaponClient

hasPedGotWeapon

HAS_PED_GOT_WEAPON0x8DECB02F88F428BC

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

SignatureJavaScript
hasPedGotWeapon(ped: Ped, weaponHash: Hash, p2: boolean): boolean
SignatureLua
hasPedGotWeapon(ped: Ped, weaponHash: Hash, p2: boolean): boolean

Usage

JavaScript
const result = hasPedGotWeapon(ped, weaponHash, p2);
Lua
local result = hasPedGotWeapon(ped, weaponHash, p2)

Parameters

ParameterTypeJavaScriptLua
pedPednumberinteger
weaponHashHashnumberinteger
p2BOOLbooleanboolean

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.

p2 should be FALSE, otherwise it seems to always return FALSE

Bool does not check if the weapon is current equipped, unfortunately.
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
BOOL HAS_PED_GOT_WEAPON(Ped ped, Hash weaponHash, BOOL p2)
Hash
0x8DECB02F88F428BC

Open in the interactive natives reference