TasksClient

taskThrowProjectile

TASK_THROW_PROJECTILE0x7285951DBF6B5A51

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

SignatureJavaScript
taskThrowProjectile(
  ped: Ped,
  x: number,
  y: number,
  z: number,
  ignoreCollisionEntityIndex: number,
  createInvincibleProjectile: boolean
): void
SignatureLua
taskThrowProjectile(
  ped: Ped,
  x: number,
  y: number,
  z: number,
  ignoreCollisionEntityIndex: integer,
  createInvincibleProjectile: boolean
)

Usage

JavaScript
taskThrowProjectile(ped, x, y, z, ignoreCollisionEntityIndex, createInvincibleProjectile);
Lua
taskThrowProjectile(ped, x, y, z, ignoreCollisionEntityIndex, createInvincibleProjectile)

Three consecutive numbers can be given as one vector: { x, y, z } (or [x, y, z]) in JavaScript, a Vector3 in Lua.

JavaScript · with vectors
taskThrowProjectile(ped, pos, ignoreCollisionEntityIndex, createInvincibleProjectile);
Lua · with vectors
taskThrowProjectile(ped, pos, ignoreCollisionEntityIndex, createInvincibleProjectile)

Parameters

ParameterTypeJavaScriptLua
pedPednumberinteger
xfloatnumbernumber
yfloatnumbernumber
zfloatnumbernumber
ignoreCollisionEntityIndexintnumberinteger
createInvincibleProjectileBOOLbooleanboolean

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.

In every case of this native, I've only seen the first parameter passed as 0, although I believe it's a Ped after seeing tasks around it using 0. That's because it's used in a Sequence Task.

The last 3 parameters are definitely coordinates after seeing them passed in other scripts, and even being used straight from the player's coordinates.


It seems that - in the decompiled scripts - this native was used on a ped who was in a vehicle to throw a projectile out the window at the player. This is something any ped will naturally do if they have a throwable and they are doing driveby-combat (although not very accurately).
It is possible, however, that this is how SWAT throws smoke grenades at the player when in cover.


The first comment is right it definately is the ped as if you look in script finale_heist2b.c line 59628 in Xbox Scripts atleast you will see task_throw_projectile and the first param is Local_559[2 <14>] if you look above it a little bit line 59622 give_weapon_to_ped uses the same exact param Local_559[2 <14>] and we all know the first param of that native is ped. So it guaranteed has to be ped. 0 just may mean to use your ped by default for some reason.

Reference

Namespace
Tasks TASK
In the game
void TASK_THROW_PROJECTILE(Ped ped, float x, float y, float z, int ignoreCollisionEntityIndex, BOOL createInvincibleProjectile)
Hash
0x7285951DBF6B5A51

Open in the interactive natives reference