WeaponClient

getWeaponObjectFromPed

GET_WEAPON_OBJECT_FROM_PED0xCAE1DC9A0E22A16D

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

SignatureJavaScript
getWeaponObjectFromPed(ped: Ped, p1: boolean): Object
SignatureLua
getWeaponObjectFromPed(ped: Ped, p1: boolean): Object

Usage

JavaScript
const object = getWeaponObjectFromPed(ped, p1);
Lua
local object = getWeaponObjectFromPed(ped, p1)

Parameters

ParameterTypeJavaScriptLua
pedPednumberinteger
p1BOOLbooleanboolean

Returns

Object JavaScript number, Lua integer

Game handle of an object (prop). Not an LS:MP netId. Convert one with lsmp.getEntityFromNetId.

Notes

From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.

Drops the current weapon and returns the object

Unknown behavior when unarmed.

Reference

Namespace
Weapon WEAPON
In the game
Object GET_WEAPON_OBJECT_FROM_PED(Ped ped, BOOL p1)
Hash
0xCAE1DC9A0E22A16D

Open in the interactive natives reference