hasEntityBeenDamagedByWeapon
HAS_ENTITY_BEEN_DAMAGED_BY_WEAPON0x131D401334815E94The 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.
hasEntityBeenDamagedByWeapon(
entity: Entity,
weaponHash: Hash,
weaponType: number
): booleanhasEntityBeenDamagedByWeapon(
entity: Entity,
weaponHash: Hash,
weaponType: integer
): booleanUsage
JavaScript
const result = hasEntityBeenDamagedByWeapon(entity, weaponHash, weaponType);Lua
local result = hasEntityBeenDamagedByWeapon(entity, weaponHash, weaponType)Parameters
| Parameter | Type | JavaScript | Lua |
|---|---|---|---|
entity | Entity | number | integer |
weaponHash | Hash | number | integer |
weaponType | int | number | integer |
Returns
BOOL JavaScript boolean, Lua booleanNotes
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