WeaponClient

hasEntityBeenDamagedByWeapon

HAS_ENTITY_BEEN_DAMAGED_BY_WEAPON0x131D401334815E94

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

SignatureJavaScript
hasEntityBeenDamagedByWeapon(
  entity: Entity,
  weaponHash: Hash,
  weaponType: number
): boolean
SignatureLua
hasEntityBeenDamagedByWeapon(
  entity: Entity,
  weaponHash: Hash,
  weaponType: integer
): boolean

Usage

JavaScript
const result = hasEntityBeenDamagedByWeapon(entity, weaponHash, weaponType);
Lua
local result = hasEntityBeenDamagedByWeapon(entity, weaponHash, weaponType)

Parameters

ParameterTypeJavaScriptLua
entityEntitynumberinteger
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_ENTITY_BEEN_DAMAGED_BY_WEAPON(Entity entity, Hash weaponHash, int weaponType)
Hash
0x131D401334815E94

Open in the interactive natives reference