RedM Natives

_COUNT_PEDS_AWARE_OF_EVENT

Counts how many peds are aware of a shocking event within a radius.

Hash0xF4860514AD354226
Runtime nameCountPedsAwareOfEvent
NamespacePED
SideClient
NameCommunity guess
Docs
Since build1207

Signature

int _COUNT_PEDS_AWARE_OF_EVENT(ScrHandle shockingEvent, float x, float y, float z, float radius, Any* entities);

Parameters

NameTypeDescription
shockingEventScrHandle—
xfloat—
yfloat—
zfloat—
radiusfloat—
entitiesAny*—

Returns int

Description

alloc8or RDR3 NativeDB

Counts how many peds are aware of a shocking event within a radius.
The eventHandle is from ADD_SHOCKING_EVENT_FOR_ENTITY. The entities output collection is capped at 15 in observed code and is used to drive reactions/tasks for the affected peds.

VORPCORE RDR3natives

Only used in SP Scripts
counts how many peds that the ADD_SHOCKING_EVENT_FOR_ENTITY were add to based on position and radius, p0 is handleId from ADD_SHOCKING_EVENT_FOR_ENTITY
p3 is a collection of entities where max is 15 (in source code), its using itemSet to get them from a volume
this count seems to be used to add a task reactions etc to these peds

Usage

Lua
local retval, entities = CountPedsAwareOfEvent(shockingEvent, x, y, z, radius, entities)

-- always works, by hash
local retval, entities = Citizen.InvokeNative(0xF4860514AD354226, shockingEvent, x, y, z, radius, Citizen.PointerValueIntInitialized(entities), Citizen.ResultAsInteger())
JavaScript and C#
JavaScript
const [retval, entities] = CountPedsAwareOfEvent(shockingEvent, x, y, z, radius, entities);

// by hash
const [retval, entities] = Citizen.invokeNative('0xF4860514AD354226', shockingEvent, x + 0.0000001, y + 0.0000001, z + 0.0000001, radius + 0.0000001, Citizen.pointerValueIntInitialized(entities), Citizen.returnResultAnyway(), Citizen.resultAsInteger());
C#
var entities = new OutputArgument();
int retval = Function.Call<int>((Hash)0xF4860514AD354226, shockingEvent, x, y, z, radius, entities);
// entities.GetResult<int>()
  • Float parameters: Lua integers (10, or whole numbers decoded from NUI/JSON) are sent as ints and read as garbage. Write 10.0 or value + 0.0. The generated JS wrappers add 0.0000001 to non-zero floats for the same reason.
  • The last argument is an in/out pointer: pass its initial value, and the updated value is returned after the result.
  • Any* arguments are often structs. Build them with a DataView buffer and pass it with :Buffer() — see the examples and notes below.
  • The name is a community guess and may change. If the named call is missing in your client build, use InvokeNative with the hash — it always works.

Sources

alloc8or RDR3 NativeDB · VORPCORE RDR3natives

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