Skip to content

setPedShootAt

Client-side

Give an NPC a world position and GTA makes it aim and fire controlled bursts at that point for the requested duration.

Syntax

bool setPedShootAt(ped thePed, Vector3 target [, int duration = 1000, int burstLength = 5])

GTA task mapping

ORIGINAL GTA TASK 0668
CTaskSimpleGunControl

SCM equivalent: TASK_SHOOT_AT_COORD

GunControl receives the coordinate and FIREBURST command directly, then creates its own CTaskSimpleUseGun attack subtask. Negative durations remain indefinite.

Arguments

thePedped

Living streamed ped simulated by this client.

targetVector3

Finite target; an XY value of 0,0 is rejected because GTA treats it as no coordinate.

durationintoptional · default 1000

Milliseconds; every negative value is indefinite.

burstLengthintoptional · default 5

Positive native burst size.

Returns

true when the native task was installed; false for failed ownership, liveness, target, or burst validation.

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.

OOP aliases

  • ped:setShootAt(target, duration, burstLength)

Where this comes from

RELATED SA:O APIS

Continue exploring

Read the system guide →