TasksClient

taskUseNearestScenarioToCoord

TASK_USE_NEAREST_SCENARIO_TO_COORD0x277F471BA9DB000B

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

SignatureJavaScript
taskUseNearestScenarioToCoord(
  ped: Ped,
  x: number,
  y: number,
  z: number,
  distance: number,
  duration: number
): void
SignatureLua
taskUseNearestScenarioToCoord(
  ped: Ped,
  x: number,
  y: number,
  z: number,
  distance: number,
  duration: integer
)

Usage

JavaScript
taskUseNearestScenarioToCoord(ped, x, y, z, distance, duration);
Lua
taskUseNearestScenarioToCoord(ped, x, y, z, distance, duration)

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
taskUseNearestScenarioToCoord(ped, pos, distance, duration);
Lua · with vectors
taskUseNearestScenarioToCoord(ped, pos, distance, duration)

Parameters

ParameterTypeJavaScriptLua
pedPednumberinteger
xfloatnumbernumber
yfloatnumbernumber
zfloatnumbernumber
distancefloatnumbernumber
durationintnumberinteger

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.

Updated variables

An alternative to taskUseNearestScenarioToCoordWarp. Makes the ped walk to the scenario instead.

Reference

Namespace
Tasks TASK
In the game
void TASK_USE_NEAREST_SCENARIO_TO_COORD(Ped ped, float x, float y, float z, float distance, int duration)
Hash
0x277F471BA9DB000B

Open in the interactive natives reference