TaskGoToCoordWhileAimingAtEntity
DocsTaskGoToCoordWhileAimingAtEntity(ped, x, y, z, entityToAimAt, moveSpeed, shoot, targetRadius, slowDistance, useNavMesh, navFlags, instantBlendAtAim, firingPattern, time)Description
Will make the ped move to a coordinate while aiming (and optionally shooting) at the given entity.
enum eFiringPatternHashes {
FIRING_PATTERN_DEFAULT = 0,
FIRING_PATTERN_BURST_FIRE = -687903391,
FIRING_PATTERN_BURST_FIRE_DRIVEBY = -753768974,
FIRING_PATTERN_FULL_AUTO = -957453492,
FIRING_PATTERN_SINGLE_SHOT = 1566631136,
FIRING_PATTERN_DELAY_FIRE_BY_ONE_SEC = 2055493265,
FIRING_PATTERN_BURST_FIRE_HELI = -1857128337,
FIRING_PATTERN_SHORT_BURSTS = 445831135,
FIRING_PATTERN_BURST_FIRE_MICRO = 1122960381,
FIRING_PATTERN_SLOW_FIRE_TANK = -490063247,
FIRING_PATTERN_TAMPA_MORTAR = -1842093953
}Parameters
| Name | Type | Description |
|---|---|---|
ped | Ped | Ped to task |
x | float | Destination X position |
y | float | Destination Y position |
z | float | Destination Z position |
entityToAimAt | Entity | Entity that the ped will aim at. |
moveSpeed | float | Mostly 2f, but also 1/1.2f, etc. |
shoot | BOOL | If true ped will shoot; false - will not |
targetRadius | float | Usually 0.5f |
slowDistance | float | Usually 4f |
useNavMesh | BOOL | — |
navFlags | int | Usually 0 or 64 |
instantBlendAtAim | BOOL | — |
firingPattern | Hash | The firing pattern to use, refer to `eFiringPatternHashes` |
time | int | Usually 20000 (ms) |
Quick Snippet: Get Coordinatesxyz
xyzAdd this command to your client script to retrieve precise locations in-game.
-- Add this to your client.lua. Type /pos in-game to copy coords.
RegisterCommand('pos', function()
local ped = PlayerPedId()
local coords = GetEntityCoords(ped)
local heading = GetEntityHeading(ped)
local output = string.format("vector4(%.2f, %.2f, %.2f, %.2f)", coords.x, coords.y, coords.z, heading)
print(output)
TriggerEvent('chat:addMessage', { args = { '^4[COORD]^0', output } })
end)Quick Snippet: Get Ped Handleped
pedUse this to get the player ped handle for this native.
-- Get the player's ped handle (client-side)
local ped = PlayerPedId()
print("Ped handle: " .. ped)
-- For a specific player's ped (server-side):
-- local targetPed = GetPlayerPed(source)Quick Snippet: Get EntityentityToAimAt
entityToAimAtUse this to obtain an entity handle from the player's aim or crosshair.
-- Get the entity the player is aiming at
local ped = PlayerPedId()
local hit, entity = GetEntityPlayerIsFreeAimingAt(PlayerId())
if hit and entity ~= 0 then
print("Entity: " .. entity)
print("Model: " .. GetEntityModel(entity))
print("Type: " .. GetEntityType(entity)) -- 1=Ped, 2=Vehicle, 3=Object
endPed Models

mp_m_freemode_01
player_zero
ig_agatha
s_m_y_cop_01
s_m_m_gaffer_01
g_m_m_armboss_01
a_c_boar
a_m_m_bevhills_01Returns
voidThis native does not return a value.