isPedInCombat
IS_PED_IN_COMBAT0x4859F1FC66A6278EThe GTA V native IS_PED_IN_COMBAT of the PED namespace, as LS:MP client scripts call it: the global function isPedInCombat, in JavaScript and in Lua.
isPedInCombat(ped: Ped, target: Ped): booleanisPedInCombat(ped: Ped, target: Ped): booleanUsage
JavaScript
const result = isPedInCombat(ped, target);Lua
local result = isPedInCombat(ped, target)Parameters
| Parameter | Type | JavaScript | Lua |
|---|---|---|---|
ped | Ped | number | integer |
target | Ped | 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.
Checks to see if ped and target are in combat with eachother. Only goes one-way: if target is engaged in combat with ped but ped has not yet reacted, the function will return false until ped starts fighting back.
p1 is usually 0 in the scripts because it gets the ped id during the task sequence. For instance: isPedInCombat(l_42E[4/*14*/], playerPedId()) // armenian2.ct4: 43794
Reference
- Namespace
- Ped PED
- In the game
BOOL IS_PED_IN_COMBAT(Ped ped, Ped target)- Hash
0x4859F1FC66A6278E