_COUNT_PEDS_AWARE_OF_EVENT
Counts how many peds are aware of a shocking event within a radius.
0xF4860514AD354226CountPedsAwareOfEventSignature
int _COUNT_PEDS_AWARE_OF_EVENT(ScrHandle shockingEvent, float x, float y, float z, float radius, Any* entities);Parameters
| Name | Type | Description |
|---|---|---|
shockingEvent | ScrHandle | — |
x | float | — |
y | float | — |
z | float | — |
radius | float | — |
entities | Any* | — |
Returns int
Description
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.
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
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#
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());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. Write10.0orvalue + 0.0. The generated JS wrappers add0.0000001to 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
InvokeNativewith the hash — it always works.
Sources
alloc8or RDR3 NativeDB · VORPCORE RDR3natives
Something wrong or missing? Contribute a verified note — corrections ship through pull requests.