getCurrentPedWeapon
GET_CURRENT_PED_WEAPON0x3A87E44BB9A01D54The GTA V native GET_CURRENT_PED_WEAPON of the WEAPON namespace, as LS:MP client scripts call it: the global function getCurrentPedWeapon, in JavaScript and in Lua.
getCurrentPedWeapon(ped: Ped, doDeadCheck: boolean): [
ok: boolean,
weaponHash: Hash
]getCurrentPedWeapon(ped: Ped, doDeadCheck: boolean): boolean, HashUsage
JavaScript
const [ok, weaponHash] = getCurrentPedWeapon(ped, doDeadCheck);Lua
local ok, weaponHash = getCurrentPedWeapon(ped, doDeadCheck)Parameters
| Parameter | Type | JavaScript | Lua |
|---|---|---|---|
ped | Ped | number | integer |
doDeadCheck | BOOL | boolean | boolean |
Returns
2 values, in this order: an array in JavaScript, multiple return values in Lua.
| # | Value | Type | JavaScript | Lua | Description |
|---|---|---|---|---|---|
| 1 | ok | BOOL | boolean | boolean | The native’s own return value. |
| 2 | weaponHash | Hash | number | integer | output |
Notes
From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.
Returns true if the hash of the equipped weapon object equals the weapon hash.
doDeadCheck does nothing in release builds.
Reference
- Namespace
- Weapon WEAPON
- In the game
BOOL GET_CURRENT_PED_WEAPON(Ped ped, Hash* weaponHash, BOOL doDeadCheck)- Hash
0x3A87E44BB9A01D54