hasPedGotWeapon
HAS_PED_GOT_WEAPON0x8DECB02F88F428BCThe 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.
hasPedGotWeapon(ped: Ped, weaponHash: Hash, p2: boolean): booleanhasPedGotWeapon(ped: Ped, weaponHash: Hash, p2: boolean): booleanUsage
JavaScript
const result = hasPedGotWeapon(ped, weaponHash, p2);Lua
local result = hasPedGotWeapon(ped, weaponHash, p2)Parameters
| Parameter | Type | JavaScript | Lua |
|---|---|---|---|
ped | Ped | number | integer |
weaponHash | Hash | number | integer |
p2 | BOOL | boolean | boolean |
Returns
BOOL JavaScript boolean, Lua booleanNotes
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