_GET_ENTITIES_NEAR_POINT (0x59B57C4B06531E1E) p5 is entityType (1=ped, 2=vehicle, 3=object), not a bitmask
Context
The native docs for _GET_ENTITIES_NEAR_POINT (0x59B57C4B06531E1E) and _GET_ENTITIES_IN_VOLUME (0x886171A12F400B89) label the last int parameter only as p5 (int) / entityType (int) with no value list. Easy trap: people assume p5 is a bitmask and pass 3 expecting "peds + vehicles", get 0 back, and conclude the native is broken.
The fix
p5 is a single eEntityType value matching what GET_ENTITY_TYPE (0x97F696ACA466B4E0) returns:
1= peds2= vehicles3= objects (props)
Not a flag mask. There is no "all entities" value — call once per type if you need everything.
Verified usage (from working community scripts)
kibook/redm-interactions/client.lua— passes3to find props for interaction promptskibook/redm-instruments/client.lua— passes3for nearby instrument propskibook/redm-fixanimals/client.lua— passes1for nearby animals/pedsDarrenJDocherty/RedM-Witnesses/client.lua— passes1for nearby ped witnesses
Standard pattern:
local itemset = CreateItemset(true)
local size = Citizen.InvokeNative(0x59B57C4B06531E1E,
coords, radius, itemset, entityType, Citizen.ResultAsInteger())
if size > 0 then
for i = 0, size - 1 do
local entity = GetIndexedItemInItemset(i, itemset)
-- ...
end
end
if IsItemsetValid(itemset) then DestroyItemset(itemset) end
Gotchas
- Pass
Citizen.ResultAsInteger()as the trailing marker in Lua — without it the return value can come back wrong. JS/TS hash-string invocations of underscore natives have similar return-type-inference issues; use the equivalent result-type hint. - Client-side only. Walks streamed entities the local client knows about. Running in a server script returns 0 unconditionally.
- Empty result is legitimate. Type
3(objects) over an empty field genuinely returns 0 — test with type1first since the local player ped will always be in range, which makes it a reliable smoke test for the call. CREATE_ITEMSET(true)marks the set script-managed (cleaned on resource stop);falseis persistent. For short-lived nearby-entity queries either works, but pair withIsItemsetValid+DestroyItemsetto be explicit.
Origin of the value list
Cross-referenced from umaruru's RDR2 prompt research gist and confirmed by GET_ENTITY_TYPE returning the same 1/2/3 values per Halen84's eEntityType enum.
Linked natives
_GET_ENTITIES_IN_VOLUME(0x886171A12F400B89)_GET_ENTITIES_NEAR_POINT(0x59B57C4B06531E1E)GET_ENTITY_TYPE(0x97F696ACA466B4E0)
Tags: entity, itemset, nearby, entitytype, props, peds, vehicles
Category: natives
Created: 2026-05-04T17:06:45.020Z