TasksClient

taskStartScenarioAtPosition

TASK_START_SCENARIO_AT_POSITION0xFA4EFC79F69D4F07

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

SignatureJavaScript
taskStartScenarioAtPosition(
  ped: Ped,
  scenarioName: string,
  x: number,
  y: number,
  z: number,
  heading: number,
  duration: number,
  sittingScenario: boolean,
  teleport: boolean
): void
SignatureLua
taskStartScenarioAtPosition(
  ped: Ped,
  scenarioName: string,
  x: number,
  y: number,
  z: number,
  heading: number,
  duration: integer,
  sittingScenario: boolean,
  teleport: boolean
)

Usage

JavaScript
taskStartScenarioAtPosition(
  ped, scenarioName, x, y, z, heading, duration, sittingScenario, teleport
);
Lua
taskStartScenarioAtPosition(
    ped, scenarioName, x, y, z, heading, duration, sittingScenario, teleport
)

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
taskStartScenarioAtPosition(
  ped, scenarioName, pos, heading, duration, sittingScenario, teleport
);
Lua · with vectors
taskStartScenarioAtPosition(
    ped, scenarioName, pos, heading, duration, sittingScenario, teleport
)

Parameters

ParameterTypeJavaScriptLua
pedPednumberinteger
scenarioNamestringstringstring
xfloatnumbernumber
yfloatnumbernumber
zfloatnumbernumber
headingfloatnumbernumber
durationintnumberinteger
sittingScenarioBOOLbooleanboolean
teleportBOOLbooleanboolean

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.

Full list of ped scenarios by DurtyFree: https://github.com/DurtyFree/gta-v-data-dumps/blob/master/scenariosCompact.json

Also a few more listed at taskStartScenarioInPlace just above.


The first parameter in every scenario has always been a Ped of some sort. The second like taskStartScenarioInPlace is the name of the scenario.

The next 4 parameters were harder to decipher. After viewing "hairdo_shop_mp.ysc.c4", and being confused from seeing the case in other scripts, they passed the first three of the arguments as one array from a function, and it looked like it was obviously x, y, and z.

I haven't seen the sixth parameter go to or over 360, making me believe that it is rotation, but I really can't confirm anything.

I have no idea what the last 3 parameters are, but I'll try to find out.

-going on the last 3 parameters, they appear to always be "0, 0, 1"

p6 -1 also used in scrips

p7 used for sitting scenarios

p8 teleports ped to position

Reference

Namespace
Tasks TASK
In the game
void TASK_START_SCENARIO_AT_POSITION(Ped ped, const char* scenarioName, float x, float y, float z, float heading, int duration, BOOL sittingScenario, BOOL teleport)
Hash
0xFA4EFC79F69D4F07

Open in the interactive natives reference