GetPedTask
This function is used to get any simple or complex task of a certain type for a ped.
It can provide feedback on all tasks relating to a ped. For example, while jumping, getPedSimplestTask will return TASK_SIMPLE_IN_AIR. If you wanted to know specifically if the player has jumped, you would use this function. If you did you will discover that while jumping Primary task 3 is TASK_COMPLEX_JUMP.
Syntax
string getPedTask ( ped thePed, string priority, int taskType )
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
- PRIMARY TASKS
Returns
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.
Example
This example draws the active primary and secondary tasks (including task hierarchy in 1.1) as your local player moves around the world.
function displayMyTask () local x,y = 100,200 for k=0,4 do local a,b,c,d = getPedTask ( getLocalPlayer(), "primary", k ) dxDrawText ( "Primary task #"..k.." is "..tostring(a).." -> "..tostring(b).." -> "..tostring(c).." -> "..tostring(d).." -> ", x, y ) y = y + 15 end y = y + 15 for k=0,5 do local a,b,c,d = getPedTask ( getLocalPlayer(), "secondary", k ) dxDrawText ( "Secondary task #"..k.." is "..tostring(a).." -> "..tostring(b).." -> "..tostring(c).." -> "..tostring(d).." -> ", x, y ) y = y + 15 end end addEventHandler ( "onClientRender", root, displayMyTask )
See Also
- canPedBeKnockedOffBike
- getPedAnalogControlState
- getPedAnimation
- getPedBonePosition
- getPedCameraRotation
- getPedControlState
- getPedMoveState
- getPedOxygenLevel
- getPedSimplestTask
- getPedTargetCollision
- getPedTargetEnd
- getPedTargetStart
- getPedTask
- getPedVoice
- getPedWeaponMuzzlePosition
- givePedWeapon
- isPedBleeding
- isPedDoingTask
- isPedReloadingWeapon
- isPedTargetingMarkerEnabled
- setAnalogControlState
- setPedAimTarget
- setPedAnalogControlState
- setPedBleeding
- setPedCameraRotation
- setPedCanBeKnockedOffBike
- setPedControlState
- setPedEnterVehicle
- setPedExitVehicle
- IsPedFootBloodEnabled
- setPedFootBloodEnabled
- setPedLookAt
- setPedOxygenLevel
- setPedTargetingMarkerEnabled
- setPedVoice
- Shared
- addPedClothes
- getPedClothes
- removePedClothes
- createPed
- getPedAmmoInClip
- getPedArmor
- getPedFightingStyle
- getPedOccupiedVehicle
- getPedOccupiedVehicleSeat
- getPedStat
- getPedTarget
- getPedTotalAmmo
- getPedWalkingStyle
- getPedWeapon
- getPedWeaponSlot
- getPedContactElement
- getValidPedModels
- isPedChoking
- isPedDead
- isPedDoingGangDriveby
- isPedDucked
- isPedHeadless
- isPedInVehicle
- isPedOnFire
- isPedOnGround
- isPedWearingJetpack
- killPed
- removePedFromVehicle
- setPedAnimation
- setPedAnimationProgress
- setPedAnimationSpeed
- setPedArmor
- setPedDoingGangDriveby
- setPedFightingStyle
- setPedHeadless
- setPedOnFire
- setPedStat
- setPedWalkingStyle
- setPedWeaponSlot
- warpPedIntoVehicle