isPedNativeAmbientCopWanderTask
Reports whether San Andreas Online's safe ambient-cop wander task is the ped's current primary task.
Syntax
bool isPedNativeAmbientCopWanderTask(ped thePed)GTA task mapping
CTaskComplexWanderSan Andreas Online reuses GTA's base Wander locomotion vtable slots with a WANDER_TYPE_COP identity and an empty scanner. Retail CTaskComplexWanderCop is never installed on an MTA ped because it reads CCopPed-only state and can enter the wanted and pursuit systems.
Arguments
thePedpedStreamed ped simulated by this client.
Returns
true only when the exact custom ambient-cop task is present in a primary slot; false otherwise.
Ownership and lifecycle
Candidate queries create nothing. A multiplayer resource must validate each proposal, create and own the real NPCs and vehicles, assign one current syncer, handle ownership changes, and clean up every element. Native AI and event tokens belong to the calling resource and are revoked when that resource stops.
- The check walks every primary slot rather than only the active leaf, so a temporary native hit or avoidance response does not make it report false.
- It distinguishes the custom ambient-cop vtable from any other task that merely shares TASK_COMPLEX_WANDER.
Example
if isPedNativeAmbientCopWanderTask(cop) then outputDebugString("cop is patrolling natively")endWhere this comes from
Continue exploring
← Back to the SA:O Lua API · How Synchronized NPCs and road traffic works →