KillPedTask

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

BETA: NEW FEATURE (BUILD: 1.6.0 r22837)

This function will be used to kill current ped tasks.

Syntax

bool killPedTask ( ped thePed, string taskType, int taskNumber, [ bool gracefully = true] )

Required arguments

  • thePed: The ped element.
  • taskType: The task type given primary or secondary, for more info see Tasks.
  • taskNumber the task slot number for reference see Tasks.

Optional arguments

  • gracefully If set to true the animation will be cut in a smooth transition, false otherwise.

Returns

If successful returns true, false otherwise.

Example

This example let you interrupt and cancel the jump animation action and clear the slot

function playerPressedKey(button, press)
    local moveState = getPedMoveState( localPlayer )
    if(moveState=="jump") then
        killPedTask(localPlayer, "primary", 3, true)
    end
end
addEventHandler("onClientKey", root, playerPressedKey)

See Also