getPedTask | Multi Theft Auto: Wiki Skip to content

getPedTask

Client-side
Server-side
Shared

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function is used to get any simple or complex task of a certain type for a ped.

OOP Syntax Help! I don't understand this!

  • Method:ped:getTask(...)

Syntax

string,​ string,​ string,​ string getPedTask ( ped thePed, string priority, int taskType )
Required Arguments
  • thePed: The ped whose task you want to retrieve.
  • priority: A string determining which set of tasks you want to retrieve it from. This must be either "primary" or "secondary".
  • taskType: An integer value representing the task type (or slot) you want to get the task from. Types can be: PRIMARY TASKS 0: TASK_PHYSICAL_RESPONSE 1: TASK_EVENT_RESPONSE_TEMP 2: TASK_EVENT_RESPONSE_NONTEMP 3: TASK_PRIMARY 4: TASK_DEFAULT SECONDARY TASKS 0: TASK_SECONDARY_ATTACK 1: TASK_SECONDARY_DUCK 2: TASK_SECONDARY_SAY 3: TASK_SECONDARY_FACIAL_COMPLEX 4: TASK_SECONDARY_PARTIAL_ANIM 5: TASK_SECONDARY_IK

Returns

  • string: value1
  • string: value2
  • string: value3
  • string: value4

Returns the name of the most complex task. See list of player tasks for valid strings. Returns false if invalid arguments are specified or if there is no task of the type specified. Returns between 1 and 4 strings. The first string contains the name of the most complex task, with simpler sub-tasks being named in the following strings. See list of player tasks for valid strings. Returns false if invalid arguments are specified or if there is no task of the type specified.

Code Examples

shared

This example draws the active primary and secondary tasks (including task hierarchy in 1.1) as your local player moves around the world.

local function renderPlayerTasks()
local textX, textY = 100, 200
for taskType = 0, 4 do
local a, b, c, d = getPedTask(localPlayer, "primary", taskType)
dxDrawText("Primary task #"..taskType.." is "..tostring(a).." -> "..tostring(b).." -> "..tostring(c).." -> "..tostring(d).." -> ", textX, textY)
textY = (textY + 15)
end
textY = (textY + 15)
for taskType = 0, 5 do
local a, b, c, d = getPedTask(localPlayer, "secondary", taskType)
dxDrawText("Secondary task #"..taskType.." is "..tostring(a).." -> "..tostring(b).." -> "..tostring(c).." -> "..tostring(d).." -> ", textX, textY)
textY = (textY + 15)
end
end
addEventHandler("onClientRender", root, renderPlayerTasks)

See Also