setPedDriveTo
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
05D1 CTaskComplexCarDriveToPointSCM 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
thePedpedLiving streamed ped simulated by this client.
theVehiclevehicleStreamed, non-blown vehicle occupied by the ped in driver seat 0 and controlled by this client.
targetVector3Finite world destination.
speedfloatFinite cruise speed from 0 up to, but not including, 255.
modestring|intoptional · default normalInteger 0..3 or normal, accurate, straight_line, or racing.
drivingStylestring|intoptional · default stop_for_carsInteger 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.
- 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
Continue exploring
← Back to the Neon Lua API · How Native ped tasks and gang tags works →