> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apex-services.site/llms.txt
> Use this file to discover all available pages before exploring further.

# APEX Pet System

> Persistent pets with stats, doghouse, and fetch gameplay.

A full-featured pet system for FiveM. Players buy pets from an NPC shop with an in-game ped preview, call them out from a persistent database, and interact via ox\_target. Pets have real stats (hunger, loyalty, stamina), doghouse placement with rest regen, fetch/frisbee play, carry mode, and full edge-case handling (death, respawn, water rescue, under-map recovery).

## Features

* Pet Shop NPC with blip, proximity prompt, pause-menu ped preview + variation cycling
* Persistent database (`apex_pets` auto-created via oxmysql)
* My Pets UI — call, dismiss, sit/stay/lay down/beg/paw/bark/enter car
* Stats — hunger decay, loyalty gain on petting, stamina affects follow speed
* Doghouse item — place, rest regen, ox\_target interactions, pick up
* Play items — tennisball (fetch), frisbee (longer throw), petfood (feeding)
* Pet redeem items — configurable items that grant specific pet models
* Carry mode — attach anim, drop with `X`
* Edge cases handled — death, respawn, water rescue, under-map recovery
* Anti-cheat — server-side price validation, rate limiting, model whitelist, input sanitization

## Requirements

<CardGroup cols={2}>
  <Card title="Required" icon="circle-check">
    `es_extended`, `ox_lib`, `oxmysql`
  </Card>

  <Card title="Optional" icon="puzzle-piece">
    `ox_target` — for interactions (disable via `Config.UseTarget = false`)
  </Card>
</CardGroup>

## Configuration

```lua config.lua theme={null}
Config.UseTarget              = true
Config.FollowTeleportDistance = 50.0
Config.UnderMapZ              = -20.0
```

`HOME` opens My Pets, `X` drops a carried pet, `E` opens the shop. `/givepet <model> <name>` is available when `Debug = true`.

## Hooks

See [Hooks reference / Pet System](/hooks/apex-pet-system). Key hooks: `Hooks.OnPurchaseSuccess`, `Hooks.IsPlayerDead`, `Hooks.OnAntiCheatViolation`.

## Resource info

<Note>
  Code accessible: `config.lua`, `hooks.lua`, `locales/*`, `html/*`. Approximately 3000 lines of Lua + NUI. English + German.
</Note>
