IS_PED_IN_MELEE_COMBAT
A.) Swinging a random melee attack (including pistol-whipping) B.) Reacting to being hit by a melee attack (including pistol-whipping) C.) Is locked-on to an enemy (arms up, strafing/skipping in the default fighting-stance, ready to dodg…
0x4E209B2C1EAD5159IsPedInMeleeCombat0x4E209B2C1EAD5159Signature
BOOL IS_PED_IN_MELEE_COMBAT(Ped ped);Parameters
| Name | Type | Description |
|---|---|---|
ped | Ped | — |
Returns BOOL
Description
Notes: The function only returns true while the ped is:
A.) Swinging a random melee attack (including pistol-whipping)
B.) Reacting to being hit by a melee attack (including pistol-whipping)
C.) Is locked-on to an enemy (arms up, strafing/skipping in the default fighting-stance, ready to dodge+counter).
You don't have to be holding the melee-targeting button to be in this stance; you stay in it by default for a few seconds after swinging at someone. If you do a sprinting punch, it returns true for the duration of the punch animation and then returns false again, even if you've punched and made-angry many peds
Usage
local retval = IsPedInMeleeCombat(ped)
-- always works, by hash
local retval = Citizen.InvokeNative(0x4E209B2C1EAD5159, ped, Citizen.ReturnResultAnyway())JavaScript and C#
const retval = IsPedInMeleeCombat(ped);
// by hash
const retval = Citizen.invokeNative('0x4E209B2C1EAD5159', ped, Citizen.returnResultAnyway());bool retval = Function.Call<bool>((Hash)0x4E209B2C1EAD5159, ped);Sources
Something wrong or missing? Contribute a verified note — corrections ship through pull requests.