RedM Natives

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…

Hash0x4E209B2C1EAD5159
Runtime nameIsPedInMeleeCombat
NamespacePED
SideClient
NameOfficial
Docs
Since build1207
GTA V hash0x4E209B2C1EAD5159

Signature

BOOL IS_PED_IN_MELEE_COMBAT(Ped ped);

Parameters

NameTypeDescription
pedPed—

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

Lua
local retval = IsPedInMeleeCombat(ped)

-- always works, by hash
local retval = Citizen.InvokeNative(0x4E209B2C1EAD5159, ped, Citizen.ReturnResultAnyway())
JavaScript and C#
JavaScript
const retval = IsPedInMeleeCombat(ped);

// by hash
const retval = Citizen.invokeNative('0x4E209B2C1EAD5159', ped, Citizen.returnResultAnyway());
C#
bool retval = Function.Call<bool>((Hash)0x4E209B2C1EAD5159, ped);

Sources

alloc8or RDR3 NativeDB

Something wrong or missing? Contribute a verified note — corrections ship through pull requests.