validatePedNativeCouple
Client-side
Pre-flight check that reports whether two peds can form a native GTA couple and which one should lead.
Syntax
table|false validatePedNativeCouple(ped a, ped b)Arguments
apedFirst candidate ped simulated by this client.
bpedSecond candidate ped simulated by this client.
Returns
A table with compatible, aLeader, leaderIndex, walkSpeedA and walkSpeedB; false without resource context or when the pair cannot be evaluated.
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
- Leadership is derived from the two native walk speeds. A pair with incompatible speeds would immediately exceed its own give-up distance.
- Pass the returned leaderIndex straight into acquirePedNativeCouple; that is the intended flow.
- This creates nothing and leases nothing.
Example
local check = validatePedNativeCouple(pedA, pedB)if check and check.compatible then local token = acquirePedNativeCouple(pedA, pedB, check.leaderIndex)endWhere this comes from
SOURCECLuaPedDefs.cppClient/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp INTRODUCED / EXTENDEDd709fa696Read the commit and why the change was made TEST RESOURCE native-ped-traffic test-resources/native-ped-traffic
RELATED SA:O APIS
Read the system guide → Continue exploring
← Back to the SA:O Lua API · How Synchronized NPCs and road traffic works →