Skip to content

setPedCanBeDraggedOut

Client-side

Choose whether a script-created NPC can be pulled out of its vehicle during a carjack. Set false to keep an important driver or passenger in the car; set true to allow the normal GTA extraction.

Syntax

bool setPedCanBeDraggedOut(ped thePed, bool canBeDraggedOut)

GTA task mapping

NATIVE GTA BEHAVIOR
No CTask is created

SCM equivalent: SET_CHAR_CANT_BE_DRAGGED_OUT

This creates no CTask. San Andreas Online persists GTA's bDontDragMeOutCar flag, with the positive Lua value inverted to match the original cannot-be-dragged-out command.

Arguments

thePedped

Script-created ped; players are rejected.

canBeDraggedOutbool

Whether GTA may pull the NPC out of a vehicle.

Returns

true when the client-local policy was stored; false for a player or invalid element.

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
  • The value may be set while the native ped is streamed out and is reapplied after GTA recreates it.
  • This scalar policy takes precedence over the matching flag inside setPedStoryProtected regardless of call order.
  • It is client-local and last-writer-wins, not resource-owned. Synchronized resources must apply it on the relevant clients and restore the intended value during cleanup.

Example

-- Keep this mission driver in the car during the scene.
local previous = canPedBeDraggedOut(driver)
assert(setPedCanBeDraggedOut(driver, false))
-- Restore the previous behavior when the scene ends.
setPedCanBeDraggedOut(driver, previous)

Where this comes from

RELATED SA:O APIS

Continue exploring

Read the system guide →