setPedCanBeDraggedOut
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
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
thePedpedScript-created ped; players are rejected.
canBeDraggedOutboolWhether 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.
- 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
Continue exploring
← Back to the SA:O Lua API · How Native ped tasks and gang tags works →