WeaponClient1 output

getCurrentPedVehicleWeapon

GET_CURRENT_PED_VEHICLE_WEAPON0x1017582BCD3832DC

The 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.

SignatureJavaScript
getCurrentPedVehicleWeapon(ped: Ped): [ok: boolean, weaponHash: Hash]
SignatureLua
getCurrentPedVehicleWeapon(ped: Ped): boolean, Hash

Usage

JavaScript
const [ok, weaponHash] = getCurrentPedVehicleWeapon(ped);
Lua
local ok, weaponHash = getCurrentPedVehicleWeapon(ped)

Parameters

ParameterTypeJavaScriptLua
pedPednumberinteger

Returns

2 values, in this order: an array in JavaScript, multiple return values in Lua.

#ValueTypeJavaScriptLuaDescription
1okBOOLbooleanbooleanThe native’s own return value.
2weaponHashHashnumberintegeroutput

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 Function

Usage:
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

Open in the interactive natives reference