Skip to content

setPedTaskSequence

Client-side

Available in Neon, not standard MTA

Builds and dispatches one native GTA sequence containing up to eight supported child tasks.

Syntax

bool setPedTaskSequence(ped thePed, table tasks [, bool repeat = false])

GTA task mapping

ORIGINAL GTA TASK 0615 / 0616 / 0618 / 063F
CTaskComplexSequenceCTaskComplexUseSequence

SCM equivalent: OPEN / CLOSE / PERFORM_SEQUENCE_TASK

Neon uses GTA's real 64-slot mission sequence pool and transfers the child interfaces into the template before dispatching UseSequence through the scripted-event path.

Arguments

thePedped

Living streamed ped simulated by this client.

taskstable

Array of 1–8 leave_car, leave_car_immediately, go_to, shoot_at, drive_to, smart_flee, or die descriptors.

repeatbooloptional · default false

Repeat the native sequence after its final child.

Returns

true when GTA accepted the composed sequence; false after validation, factory, sequence-slot, or dispatch failure.

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
  • leave_car requires a vehicle; go_to and shoot_at use the same fields and defaults as their standalone functions.
  • drive_to requires x/y/z and speed, with optional mode, drivingStyle, and vehicleModel. It carries no vehicle pointer, matching SCM's placeholders so GTA binds the ped's current vehicle when that child starts.
  • leave_car_immediately requires a streamed vehicle. smart_flee requires a streamed target ped, a positive safeDistance, and a duration of -1 or at least zero. die has no extra fields.
  • Child-task ownership transfers into GTA's global sequence template; the Lua table is not retained.

OOP aliases

  • ped:setTaskSequence(tasks, repeat)

Example

local tasks = {
{ task = "drive_to", x = 2410.74, y = -1960.03, z = 12.39, speed = 13, mode = "normal", vehicleModel = 412, drivingStyle = "avoid_cars" },
{ task = "drive_to", x = 2326.90, y = -1969.68, z = 12.37, speed = 15, mode = "normal", vehicleModel = 412, drivingStyle = "avoid_cars" },
}
assert(setPedTaskSequence(ballasDriver, tasks))

Where this comes from

RELATED NEON APIS

Continue exploring

Read the system guide →