getCurrentPedVehicleWeapon
GET_CURRENT_PED_VEHICLE_WEAPON0x1017582BCD3832DCThe GTA V native GET_CURRENT_PED_VEHICLE_WEAPON of the WEAPON namespace, as LS:MP client scripts call it: the global function getCurrentPedVehicleWeapon, in JavaScript and in Lua.
getCurrentPedVehicleWeapon(ped: Ped): [ok: boolean, weaponHash: Hash]getCurrentPedVehicleWeapon(ped: Ped): boolean, HashUsage
JavaScript
const [ok, weaponHash] = getCurrentPedVehicleWeapon(ped);Lua
local ok, weaponHash = getCurrentPedVehicleWeapon(ped)Parameters
| Parameter | Type | JavaScript | Lua |
|---|---|---|---|
ped | Ped | number | integer |
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.
Example in VB
Public Shared Function GetVehicleCurrentWeapon(Ped As Ped) As Integer
Dim arg As New OutputArgument()
Native.Function.Call(Hash.GET_CURRENT_PED_VEHICLE_WEAPON, Ped, arg)
Return arg.GetResult(Of Integer)()
End FunctionUsage:
If GetVehicleCurrentWeapon(Game.Player.Character) = -821520672 Then ...Do something
Note: -821520672 = VEHICLE_WEAPON_PLANE_ROCKET
Reference
- Namespace
- Weapon WEAPON
- In the game
BOOL GET_CURRENT_PED_VEHICLE_WEAPON(Ped ped, Hash* weaponHash)- Hash
0x1017582BCD3832DC