> For the complete documentation index, see [llms.txt](https://nyx-store.gitbook.io/nyx-store-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nyx-store.gitbook.io/nyx-store-docs/resources/nyx-target/client-exports/addped.md).

# AddPed

## AddPed

This export does the equivalent of AddTargetEntity

### Arguments

<table><thead><tr><th>Argument</th><th>Description</th><th data-hidden></th></tr></thead><tbody><tr><td>identifier</td><td>The unique string identifier of this target, in-case you want to remove it later</td><td></td></tr><tr><td>peds</td><td>A single, or table of, pedsthat the target should be for</td><td></td></tr><tr><td>options</td><td>The options for the target (see <a data-mention href="/pages/r7pYKHFFPtl7faU3zkXp">/pages/r7pYKHFFPtl7faU3zkXp</a>)</td><td></td></tr></tbody></table>

### Usage

```lua
exports['nyx2_target']:AddPed(identifier, peds, options)
```

### Example

```lua
local pedCoords = vector4(-71.38, -821.39, 326.18 - 1.0, 52.81)
local pedModel = GetHashKey('mp_m_freemode_01')

RequestModel(pedModel)
while not HasModelLoaded(pedModel) do
    Wait(0)
end

local ped = CreatePed(4, pedModel, pedCoords.x, pedCoords.y, pedCoords.z, pedCoords.w, false, false)
SetEntityAsMissionEntity(ped, true, true)
SetBlockingOfNonTemporaryEvents(ped, true)
FreezeEntityPosition(ped, true)
SetEntityInvincible(ped, true)
SetEntityVisible(ped, true)
SetEntityAlpha(ped, 255, false)
SetModelAsNoLongerNeeded(pedModel)

exports['nyx2_target']:AddPed('debug_ped', ped, {{
    title = 'Debug Ped',
    icon = 'fas fa-user',
    action = function(zone)
        local QBCore = exports['qb-core']:GetCoreObject()
        QBCore.Functions.Notify('This is a ped!', 'success')
    end,
    canInteract = function(zone)
        return true
    end,
    job = nil, -- if nil, all jobs can interact
    gang = nil, -- if nil, all gangs can interact
    citizenid = nil, -- if nil, all players can interact
    item = nil -- if nil, don't require an item to interact
}})
```

## RemovePed

This export removes a pedtarget that you have created.

### Arguments

<table><thead><tr><th>Argument</th><th>Description</th><th data-hidden></th></tr></thead><tbody><tr><td>identifier</td><td>The unique string identifier of the zone you want to remove</td><td></td></tr></tbody></table>

### Example

```lua
exports['nyx2_target']:RemovePed('debug_ped')
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://nyx-store.gitbook.io/nyx-store-docs/resources/nyx-target/client-exports/addped.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
