# killPedTask (Client)

> Removes the task a ped runs in a slot.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Peds
- **URL**: https://wiki.mymp.gg/en/killPedTask

## Syntax

```lua
bool killPedTask(ped ped, string priority, int slot [, bool gracefully = true])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `ped` | `ped` | The ped or player. |
| `priority` | `string` | `primary` or `secondary`. |
| `slot` | `int` | The slot, as in `getPedTask`. Primary slot `4` (default) cannot be removed. |
| `gracefully` | `bool` | `true` lets the task wind down before it is removed; `false` removes it outright. *(default: `true`)* |

## Returns

`true` if there was a task and it was removed, `false` if the slot was empty or the ped does not exist in the game.

## Example

```lua
bindKey("backspace", "down", function()
    killPedTask(localPlayer, "primary", 3)
end)
```

### Note

An invalid priority, a slot out of range or primary slot `4` raise an error instead of returning `false`.

## See also

- [getPedTask (Client)](https://wiki.mymp.gg/en/getPedTask.md): Gets the task a ped runs in a slot and all its subtasks.
- [isPedDoingTask (Client)](https://wiki.mymp.gg/en/isPedDoingTask.md): Tells whether a ped is running a task, in any slot and at any subtask level.
- [getPedSimplestTask (Client)](https://wiki.mymp.gg/en/getPedSimplestTask.md): Gets the simplest task the ped is running right now.
