Skip to content

setPedDriveTo

Client-side

Available in Neon, not standard MTA

Queues GTA's finite road-driving task for an owned ped in the driver seat of an owned vehicle.

Syntax

bool setPedDriveTo(ped thePed, vehicle theVehicle, Vector3 target, float speed [, string|int mode = "normal", string|int drivingStyle = "stop_for_cars"])

GTA task mapping

ORIGINAL GTA TASK 05D1
CTaskComplexCarDriveToPoint

SCM equivalent: TASK_CAR_DRIVE_TO_COORD

The direct form supplies the current vehicle, desired model -1, and native radius -1.0 before queuing GTA's original task through the script-command path.

Arguments

thePedped

Living streamed ped simulated by this client.

theVehiclevehicle

Streamed, non-blown vehicle occupied by the ped in driver seat 0 and controlled by this client.

targetVector3

Finite world destination.

speedfloat

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

modestring|intoptional · default normal

Integer 0..3 or normal, accurate, straight_line, or racing.

drivingStylestring|intoptional · default stop_for_cars

Integer 0..6 or one of the documented stop/avoid/plough-through names.

Returns

true when GTA accepted the scripted command; false when ped, vehicle, seat, ownership, target, speed, mode, style, or 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
  • true does not mean the destination has been reached; the API has no completion event or durable task handle.
  • The linked route harness exercises this task inside a native sequence. The standalone call has not been exercised separately in game.

OOP aliases

  • ped:setDriveTo(vehicle, target, speed, mode, drivingStyle)

Example

assert(setPedDriveTo(driver, vehicle, Vector3(2502.89, -1674.71, 12.37), 15, "normal", "avoid_cars"))

Where this comes from

RELATED NEON APIS

Continue exploring

Read the system guide →