WeaponClient

hasPedBeenDamagedByWeapon

HAS_PED_BEEN_DAMAGED_BY_WEAPON0x2D343D2219CD027A

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

SignatureJavaScript
hasPedBeenDamagedByWeapon(
  ped: Ped,
  weaponHash: Hash,
  weaponType: number
): boolean
SignatureLua
hasPedBeenDamagedByWeapon(
  ped: Ped,
  weaponHash: Hash,
  weaponType: integer
): boolean

Usage

JavaScript
const result = hasPedBeenDamagedByWeapon(ped, weaponHash, weaponType);
Lua
local result = hasPedBeenDamagedByWeapon(ped, weaponHash, weaponType)

Parameters

ParameterTypeJavaScriptLua
pedPednumberinteger
weaponHashHashnumberinteger
weaponTypeintnumberinteger

Returns

BOOL JavaScript boolean, Lua boolean

Notes

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

It determines what weapons caused damage:

If you want to define only a specific weapon, second parameter=weapon hash code, third parameter=0
If you want to define any melee weapon, second parameter=0, third parameter=1.
If you want to identify any weapon (firearms, melee, rockets, etc.), second parameter=0, third parameter=2.
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_BEEN_DAMAGED_BY_WEAPON(Ped ped, Hash weaponHash, int weaponType)
Hash
0x2D343D2219CD027A

Open in the interactive natives reference