PedClient

isPedInCombat

IS_PED_IN_COMBAT0x4859F1FC66A6278E

The 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.

SignatureJavaScript
isPedInCombat(ped: Ped, target: Ped): boolean
SignatureLua
isPedInCombat(ped: Ped, target: Ped): boolean

Usage

JavaScript
const result = isPedInCombat(ped, target);
Lua
local result = isPedInCombat(ped, target)

Parameters

ParameterTypeJavaScriptLua
pedPednumberinteger
targetPednumberinteger

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.

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

Open in the interactive natives reference