TasksClient

taskVehicleHeliProtect

TASK_VEHICLE_HELI_PROTECT0x1E09C32048FEFD1C

The GTA V native TASK_VEHICLE_HELI_PROTECT of the TASK namespace, as LS:MP client scripts call it: the global function taskVehicleHeliProtect, in JavaScript and in Lua.

SignatureJavaScript
taskVehicleHeliProtect(
  pilot: Ped,
  vehicle: Vehicle,
  entityToFollow: Entity,
  targetSpeed: number,
  drivingFlags: number,
  radius: number,
  altitude: number,
  heliFlags: number
): void
SignatureLua
taskVehicleHeliProtect(
  pilot: Ped,
  vehicle: Vehicle,
  entityToFollow: Entity,
  targetSpeed: number,
  drivingFlags: integer,
  radius: number,
  altitude: integer,
  heliFlags: integer
)

Usage

JavaScript
taskVehicleHeliProtect(
  pilot, vehicle, entityToFollow, targetSpeed, drivingFlags, radius, altitude, heliFlags
);
Lua
taskVehicleHeliProtect(
    pilot, vehicle, entityToFollow, targetSpeed, drivingFlags, radius, altitude, heliFlags
)

Parameters

ParameterTypeJavaScriptLuaDescription
pilotPednumberinteger
vehicleVehiclenumberinteger
entityToFollowEntitynumberintegeryou can provide a Vehicle entity or a Ped entity, the heli will protect them.
targetSpeedfloatnumbernumber
drivingFlagsintnumberinteger
radiusfloatnumbernumber
altitudeintnumberinteger
heliFlagsintnumberinteger

Returns

Nothing. In JavaScript the call evaluates to undefined.

Notes

From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.

pilot, vehicle and altitude are rather self-explanatory.

p4: is unused variable in the function.

'targetSpeed': The pilot will dip the nose AS MUCH AS POSSIBLE so as to reach this value AS FAST AS POSSIBLE. As such, you'll want to modulate it as opposed to calling it via a hard-wired, constant #.

'radius' isn't just "stop within radius of X of target" like with ground vehicles. In this case, the pilot will fly an entire circle around 'radius' and continue to do so.

NOT CONFIRMED: p7 appears to be a FlyingStyle enum. Still investigating it as of this writing, but playing around with values here appears to result in different -behavior- as opposed to offsetting coordinates, altitude, target speed, etc.

NOTE: If the pilot finds enemies, it will engage them until it kills them, but will return to protect the ped/vehicle given shortly thereafter.

Reference

Namespace
Tasks TASK
In the game
void TASK_VEHICLE_HELI_PROTECT(Ped pilot, Vehicle vehicle, Entity entityToFollow, float targetSpeed, int drivingFlags, float radius, int altitude, int heliFlags)
Hash
0x1E09C32048FEFD1C

Open in the interactive natives reference