# Client

NPC spawning, target registration, zones, and UI flow.

## NPC Spawning

On resource start a thread spawns the pawn shop ped at the configured `vector4` coordinates:

```lua
pawnPed = CreatePed(0, pedModel, x, y, z - 1.0, w, false, false)
SetEntityAsMissionEntity(pawnPed, true, true)
SetPedFleeAttributes(pawnPed, 0, 0)
SetBlockingOfNonTemporaryEvents(pawnPed, true)
SetEntityInvincible(pawnPed, true)
FreezeEntityPosition(pawnPed, true)
```

A map blip (sprite 431, colour 5) is created at the same location.

## Target Registration

The `addTarget(entity)` function auto-detects the active target resource:

| Target      | Export used                                             |
| ----------- | ------------------------------------------------------- |
| `ox_target` | `exports['ox_target']:addEntity(entity, options)`       |
| `qb-target` | `exports['qb-target']:AddTargetEntity(entity, options)` |
| `qtarget`   | `exports['qtarget']:AddTargetEntity(entity, options)`   |

{% hint style="info" %}
If `Config.UseTarget` is `false`, target registration is skipped entirely and the E-key thread is used instead.
{% endhint %}

## E Key Fallback

When `Config.UseTarget = false`, a polling thread runs:


---

# Agent Instructions: 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:

```
GET https://mohssins.gitbook.io/mohscriptsdocs/moh-pawnshop/client.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
