hasPedBeenDamagedByWeapon
HAS_PED_BEEN_DAMAGED_BY_WEAPON0x2D343D2219CD027AThe 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.
hasPedBeenDamagedByWeapon(
ped: Ped,
weaponHash: Hash,
weaponType: number
): booleanhasPedBeenDamagedByWeapon(
ped: Ped,
weaponHash: Hash,
weaponType: integer
): booleanUsage
JavaScript
const result = hasPedBeenDamagedByWeapon(ped, weaponHash, weaponType);Lua
local result = hasPedBeenDamagedByWeapon(ped, weaponHash, weaponType)Parameters
| Parameter | Type | JavaScript | Lua |
|---|---|---|---|
ped | Ped | 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_PED_BEEN_DAMAGED_BY_WEAPON(Ped ped, Hash weaponHash, int weaponType)- Hash
0x2D343D2219CD027A