TasksClient

taskShootAtEntity

TASK_SHOOT_AT_ENTITY0x08DA95E8298AE772

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

SignatureJavaScript
taskShootAtEntity(
  entity: Entity,
  target: Entity,
  duration: number,
  firingPattern: Hash
): void
SignatureLua
taskShootAtEntity(
  entity: Entity,
  target: Entity,
  duration: integer,
  firingPattern: Hash
)

Usage

JavaScript
taskShootAtEntity(entity, target, duration, firingPattern);
Lua
taskShootAtEntity(entity, target, duration, firingPattern)

Parameters

ParameterTypeJavaScriptLua
entityEntitynumberinteger
targetEntitynumberinteger
durationintnumberinteger
firingPatternHashnumberinteger

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.

//this part of the code is to determine at which entity the player is aiming, for example if you want to create a mod where you give orders to peds
Entity aimedentity;
Player player = playerId();
PLAYER::_GET_AIMED_ENTITY(player, &aimedentity);

//bg is an array of peds
taskShootAtEntity(bg[i], aimedentity, 5000, getHashKey("FIRING_PATTERN_FULL_AUTO"));

in practical usage, getting the entity the player is aiming at and then task the peds to shoot at the entity, at a button press event would be better.

Firing Pattern Hash Information: https://pastebin.com/Px036isB

Reference

Namespace
Tasks TASK
In the game
void TASK_SHOOT_AT_ENTITY(Entity entity, Entity target, int duration, Hash firingPattern)
Hash
0x08DA95E8298AE772

Open in the interactive natives reference