Skip to content

setPedDriveMission

Client-side

Tell an NPC driver to escort another vehicle from its left side using GTA's original mission-driving AI.

Syntax

bool setPedDriveMission(ped thePed, vehicle theVehicle, vehicle targetVehicle, string|int mission, float speed [, string|int drivingStyle = "stop_for_cars"])

GTA task mapping

ORIGINAL GTA TASK
CTaskComplexCarDriveMission

SCM equivalent: MISSION_ESCORT_LEFT

San Andreas Online currently admits only GTA mission ID 29, the escort-left behavior verified by the Sweet & Kendl checkpoint.

Arguments

thePedped

Living streamed ped simulated by this client.

theVehiclevehicle

Streamed, non-blown vehicle occupied and controlled by the ped.

targetVehiclevehicle

Different streamed, non-blown vehicle to escort.

missionstring|int

escort_left or its native ID 29.

speedfloat

Finite cruise speed from 0 up to, but not including, 255.

drivingStylestring|intoptional · default stop_for_cars

Integer 0..6 or a documented driving-style name.

Returns

true when GTA accepted the escort task; false when ownership, vehicles, seat, mission, speed, style, or native task construction is invalid.

Ownership and lifecycle

Low-level ped task calls require the client that simulates the living, streamed ped. Driving tasks also require control of the streamed vehicle. They do not create lifecycle handles; the optional native-task-runtime adds server-owned route epochs and reconstruction for drive_to routes. Gang-tag ownership is resource-exclusive, survives object streaming and recreation, and is released automatically when the owner stops.

Important behavior
  • escort_left is the only mission mode currently admitted. true means the task was accepted, not that the escort is complete.

Example

-- client.lua
local escortCar = createVehicle(412, 2490, -1685, 13.4)
local targetCar = createVehicle(492, 2500, -1685, 13.4)
local driver = createPed(105, 2490, -1685, 13.4)
warpPedIntoVehicle(driver, escortCar, 0)
assert(setPedDriveMission(driver, escortCar, targetCar, "escort_left", 18, "avoid_cars"))

Where this comes from

RELATED SA:O APIS

Continue exploring

Read the system guide →