Skip to content

isPedNativeAmbientCopWanderTask

Client-side

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

ORIGINAL GTA TASK
CTaskComplexWander

San 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

thePedped

Streamed 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.

Important behavior
  • 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")
end

Where this comes from

RELATED SA:O APIS

Continue exploring

Read the system guide →