getAmbientVehicleOccupantModelCandidate
Client-side
Ask GTA which pedestrian skins naturally fit a vehicle, so it can be created with a suitable driver and passengers.
Syntax
table|false getAmbientVehicleOccupantModelCandidate(int vehicleModelId [, int maximumOccupants = 4])Arguments
vehicleModelIdintSupported civilian road-vehicle model ID.
maximumOccupantsintoptional · default 4Maximum number of proposed occupants, from 1 through 4.
Returns
An array of one to four pedestrian model IDs, or false when GTA cannot produce a compatible occupant list.
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 first model is used for the driver; any remaining models can be used for passengers.
- The function creates no peds or vehicle.
Where this comes from
SOURCECLuaWorldDefs.cppClient/mods/deathmatch/logic/luadefs/CLuaWorldDefs.cpp INTRODUCED / EXTENDEDb23f57d74Read the commit and why the change was made TEST RESOURCE native-vehicle-traffic test-resources/native-vehicle-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 →