# PED::_COUNT_PEDS_AWARE_OF_EVENT

- **Hash:** `0xF4860514AD354226`
- **Namespace:** PED
- **Runtime name (Lua/JS):** `CountPedsAwareOfEvent`
- **Side:** client (game native)
- **Name status:** community guess (may change)
- **Documentation:** described
- **Since game build:** 1207
- **URL:** https://natives.borderlinerp.com/natives/PED/_COUNT_PEDS_AWARE_OF_EVENT

## Signature

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

## Parameters

- `shockingEvent` (`ScrHandle`)
- `x` (`float`)
- `y` (`float`)
- `z` (`float`)
- `radius` (`float`)
- `entities` (`Any*`)

## Returns

`int`

## Description

*Source: 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.

*Source: 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

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

-- always available, by hash
local retval, entities = Citizen.InvokeNative(0xF4860514AD354226, shockingEvent, x, y, z, radius, Citizen.PointerValueIntInitialized(entities), Citizen.ResultAsInteger())
```

### JavaScript

```js
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#

```csharp
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.*
