# EXPORTY

## secretrp-vehiclekeys — Exporty

Dokumentace všech exportů. Klikni na název exportu pro rozbalení detailů.

**Resource:** `secretrp-vehiclekeys`

```lua
local VK = exports['secretrp-vehiclekeys']
```

{% hint style="info" %}
Exporty z vypnutých modulů v `config.lua` se neregistrují (Hotwire, Ignition, Diagnostic).
{% endhint %}

## Client exporty

### Klíče

<details>

<summary><strong>GiveKeys</strong></summary>

**Popis:** Dá hráči klíče k vozidlu (přidá item do inventáře).

|               |                                                              |
| ------------- | ------------------------------------------------------------ |
| **Parametry** | `plate: string`, `model: string`, `bypassKeyCheck?: boolean` |
| **Návrat**    | —                                                            |

```lua
exports['secretrp-vehiclekeys']:GiveKeys('ABC123', 'sultan', false)
```

</details>

<details>

<summary><strong>RemoveKeys</strong></summary>

**Popis:** Odebere klíče k vozidlu z inventáře hráče.

|               |                                  |
| ------------- | -------------------------------- |
| **Parametry** | `plate: string`, `model: string` |
| **Návrat**    | —                                |

```lua
exports['secretrp-vehiclekeys']:RemoveKeys('ABC123', 'sultan')
```

</details>

<details>

<summary><strong>GetKey</strong></summary>

**Popis:** Zjistí, zda má hráč klíč (inventář nebo admin klíč).

|               |                                   |
| ------------- | --------------------------------- |
| **Parametry** | `plate: string`, `model?: string` |
| **Návrat**    | `boolean`                         |

```lua
local hasKey = exports['secretrp-vehiclekeys']:GetKey('ABC123', 'sultan')
```

</details>

<details>

<summary><strong>GiveKeysAuto</strong></summary>

**Popis:** Dá klíče k vozidlu, ve kterém hráč právě sedí.

|               |                            |
| ------------- | -------------------------- |
| **Parametry** | `bypassKeyCheck?: boolean` |
| **Návrat**    | —                          |

```lua
exports['secretrp-vehiclekeys']:GiveKeysAuto(false)
```

</details>

<details>

<summary><strong>RemoveKeysAuto</strong></summary>

**Popis:** Odebere klíče k aktuálnímu vozidlu.

|               |   |
| ------------- | - |
| **Parametry** | — |
| **Návrat**    | — |

```lua
exports['secretrp-vehiclekeys']:RemoveKeysAuto()
```

</details>

<details>

<summary><strong>GetKeyAuto</strong></summary>

**Popis:** Zjistí, zda má hráč klíč k aktuálnímu vozidlu.

|               |           |
| ------------- | --------- |
| **Parametry** | —         |
| **Návrat**    | `boolean` |

```lua
local hasKey = exports['secretrp-vehiclekeys']:GetKeyAuto()
```

</details>

<details>

<summary><strong>HasPhysicalKey</strong></summary>

**Popis:** Kontrola fyzického klíče v inventáři (bez admin klíče a zapalování).

|               |                                   |
| ------------- | --------------------------------- |
| **Parametry** | `plate: string`, `model?: string` |
| **Návrat**    | `boolean`                         |

```lua
local has = exports['secretrp-vehiclekeys']:HasPhysicalKey('ABC123', 'sultan')
```

</details>

<details>

<summary><strong>CanUseVehicle</strong></summary>

**Popis:** Může hráč vozidlo použít? (alias na `CanAccessVehicle`).

|               |                   |
| ------------- | ----------------- |
| **Parametry** | `vehicle: number` |
| **Návrat**    | `boolean`         |

```lua
local ok = exports['secretrp-vehiclekeys']:CanUseVehicle(vehicle)
```

</details>

<details>

<summary><strong>CanAccessVehicle</strong></summary>

**Popis:** Má hráč přístup? Počítá klíč v inventáři, klíče v zapalování a job vozidla.

|               |                   |
| ------------- | ----------------- |
| **Parametry** | `vehicle: number` |
| **Návrat**    | `boolean`         |

```lua
local ok = exports['secretrp-vehiclekeys']:CanAccessVehicle(vehicle)
```

</details>

<details>

<summary><strong>IsJobSharedVehicle</strong></summary>

**Popis:** Je vozidlo sdílené pro job hráče? (`Config.Ignition.JobShared`)

|               |                   |
| ------------- | ----------------- |
| **Parametry** | `vehicle: number` |
| **Návrat**    | `boolean`         |

```lua
local shared = exports['secretrp-vehiclekeys']:IsJobSharedVehicle(vehicle)
```

</details>

<details>

<summary><strong>IsNpcVehicle</strong></summary>

**Popis:** Je vozidlo NPC (není vlastněné hráčem)?

|               |                   |
| ------------- | ----------------- |
| **Parametry** | `vehicle: number` |
| **Návrat**    | `boolean`         |

```lua
local npc = exports['secretrp-vehiclekeys']:IsNpcVehicle(vehicle)
```

</details>

<details>

<summary><strong>AreKeysInIgnition</strong></summary>

**Popis:** Jsou klíče aktuálně v zapalování dané SPZ?

|               |                 |
| ------------- | --------------- |
| **Parametry** | `plate: string` |
| **Návrat**    | `boolean`       |

```lua
local inIgnition = exports['secretrp-vehiclekeys']:AreKeysInIgnition('ABC123')
```

</details>

<details>

<summary><strong>RequestKeyTransfer</strong></summary>

**Popis:** Předá klíče jinému hráči.

|               |                                                               |
| ------------- | ------------------------------------------------------------- |
| **Parametry** | `payload: { targetId: number, plate: string, model: string }` |
| **Návrat**    | `boolean`, `string?`                                          |

```lua
exports['secretrp-vehiclekeys']:RequestKeyTransfer({
    targetId = 12,
    plate = 'ABC123',
    model = 'sultan',
})
```

</details>

### Zámek / dveře

<details>

<summary><strong>OpenCar</strong></summary>

**Popis:** Odemkne vozidlo.

|               |                   |
| ------------- | ----------------- |
| **Parametry** | `vehicle: number` |
| **Návrat**    | —                 |

```lua
exports['secretrp-vehiclekeys']:OpenCar(vehicle)
```

</details>

<details>

<summary><strong>CloseCar</strong></summary>

**Popis:** Zamkne vozidlo.

|               |                   |
| ------------- | ----------------- |
| **Parametry** | `vehicle: number` |
| **Návrat**    | —                 |

```lua
exports['secretrp-vehiclekeys']:CloseCar(vehicle)
```

</details>

<details>

<summary><strong>DoorLogic</strong></summary>

**Popis:** Přepne zámek vozidla (toggle). Hraje animaci klíčků, sync stavu.

|               |                                                                                                         |
| ------------- | ------------------------------------------------------------------------------------------------------- |
| **Parametry** | `vehicle: number`, `skipAnimation?: boolean`, `forcedDoorStatus?: number`, `skipNotification?: boolean` |
| **Návrat**    | —                                                                                                       |

```lua
exports['secretrp-vehiclekeys']:DoorLogic(vehicle)
exports['secretrp-vehiclekeys']:DoorLogic(vehicle, false, 2, false) -- vynutit zamčení
```

</details>

<details>

<summary><strong>GetDoorState</strong></summary>

**Popis:** Vrátí stav zámků vozidla.

|               |                                    |
| ------------- | ---------------------------------- |
| **Parametry** | `vehicle: number`                  |
| **Návrat**    | `number` (`-1` = neplatné vozidlo) |

```lua
local state = exports['secretrp-vehiclekeys']:GetDoorState(vehicle)
```

</details>

### Motor / zapalování

{% hint style="warning" %}
Vyžaduje `Config.Ignition.Enabled = true`
{% endhint %}

<details>

<summary><strong>toggleEngine</strong></summary>

**Popis:** Zapne, vypne nebo přepne motor.

|               |                                                  |
| ------------- | ------------------------------------------------ |
| **Parametry** | `forceState?: boolean`, `targetVehicle?: number` |
| **Návrat**    | `boolean`                                        |

```lua
exports['secretrp-vehiclekeys']:toggleEngine()
exports['secretrp-vehiclekeys']:toggleEngine(true, vehicle)
```

</details>

<details>

<summary><strong>toggleEngineIgnition</strong></summary>

**Popis:** Alias na `toggleEngine`.

|               |                                                  |
| ------------- | ------------------------------------------------ |
| **Parametry** | `forceState?: boolean`, `targetVehicle?: number` |
| **Návrat**    | `boolean`                                        |

```lua
exports['secretrp-vehiclekeys']:toggleEngineIgnition(true, vehicle)
```

</details>

<details>

<summary><strong>isEngineRunning</strong></summary>

**Popis:** Zjistí, zda motor běží.

|               |                    |
| ------------- | ------------------ |
| **Parametry** | `vehicle?: number` |
| **Návrat**    | `boolean`          |

```lua
local running = exports['secretrp-vehiclekeys']:isEngineRunning(vehicle)
```

</details>

<details>

<summary><strong>Event — toggleEngine</strong></summary>

**Popis:** Externí event pro zapnutí/vypnutí motoru z jiného scriptu.

```lua
TriggerEvent('secretrp-vehiclekeys:client:toggleEngine')
TriggerEvent('secretrp-vehiclekeys:client:toggleEngine', true)
```

</details>

### Hotwire

{% hint style="warning" %}
Vyžaduje `Config.Hotwire.Enabled = true`
{% endhint %}

<details>

<summary><strong>disableHotwire</strong></summary>

**Popis:** Dočasně vypne / zapne hotwire (např. v garáži).

|               |                     |
| ------------- | ------------------- |
| **Parametry** | `disabled: boolean` |
| **Návrat**    | —                   |

```lua
exports['secretrp-vehiclekeys']:disableHotwire(true)
exports['secretrp-vehiclekeys']:disableHotwire(false)
```

</details>

<details>

<summary><strong>tryHotwire</strong></summary>

**Popis:** Spustí hotwire — progress bar + skill check. Po úspěchu nastartuje motor.

|               |   |
| ------------- | - |
| **Parametry** | — |
| **Návrat**    | — |

```lua
exports['secretrp-vehiclekeys']:tryHotwire()
```

</details>

<details>

<summary><strong>refreshHotwireHint</strong></summary>

**Popis:** Obnoví nebo skryje hotwire hint na obrazovce.

|               |   |
| ------------- | - |
| **Parametry** | — |
| **Návrat**    | — |

```lua
exports['secretrp-vehiclekeys']:refreshHotwireHint()
```

</details>

<details>

<summary><strong>claimHotwireIgnition</strong></summary>

**Popis:** Interní — nastartuje motor po úspěšném hotwire. Volá se ze scriptu, ne z UI.

|               |                                    |
| ------------- | ---------------------------------- |
| **Parametry** | `vehicle: number`, `plate: string` |
| **Návrat**    | —                                  |

```lua
exports['secretrp-vehiclekeys']:claimHotwireIgnition(vehicle, plate)
```

</details>

### Diagnostika

{% hint style="warning" %}
Vyžaduje `Config.Diagnostic.Enabled = true` a správný job.
{% endhint %}

<details>

<summary><strong>OpenDiagnostic</strong></summary>

**Popis:** Spustí diagnostiku na nejbližším / cíleném vozidle.

|               |                   |
| ------------- | ----------------- |
| **Parametry** | `entity?: number` |
| **Návrat**    | `boolean`         |

```lua
exports['secretrp-vehiclekeys']:OpenDiagnostic()
exports['secretrp-vehiclekeys']:OpenDiagnostic(vehicle)
```

</details>

<details>

<summary><strong>RunDiagnosticScan</strong></summary>

**Popis:** Sken vozidla + ox\_lib menu s výsledky (motor, palivo, pneu…).

|               |                   |
| ------------- | ----------------- |
| **Parametry** | `entity?: number` |
| **Návrat**    | `boolean`         |

```lua
exports['secretrp-vehiclekeys']:RunDiagnosticScan(vehicle)
```

</details>

<details>

<summary><strong>RunTintMeasure</strong></summary>

**Popis:** Měření tónování skel (policie / sheriff).

|               |                   |
| ------------- | ----------------- |
| **Parametry** | `entity?: number` |
| **Návrat**    | `boolean`         |

```lua
exports['secretrp-vehiclekeys']:RunTintMeasure(vehicle)
```

</details>

## Server exporty

### Klíče

<details>

<summary><strong>GiveServerKeys</strong></summary>

**Popis:** Dá klíče hráči ze serveru (garáže, admin scripty).

|               |                                                                                      |
| ------------- | ------------------------------------------------------------------------------------ |
| **Parametry** | `targetSource: number`, `plate: string`, `model: string`, `bypassKeyCheck?: boolean` |
| **Návrat**    | `boolean`                                                                            |

```lua
local ok = exports['secretrp-vehiclekeys']:GiveServerKeys(source, plate, model, false)
```

</details>

<details>

<summary><strong>RemoveServerKeys</strong></summary>

**Popis:** Odebere klíče hráči ze serveru.

|               |                                                          |
| ------------- | -------------------------------------------------------- |
| **Parametry** | `targetSource: number`, `plate: string`, `model: string` |
| **Návrat**    | `boolean`                                                |

```lua
exports['secretrp-vehiclekeys']:RemoveServerKeys(source, plate, model)
```

</details>

<details>

<summary><strong>GetServerKey</strong></summary>

**Popis:** Zjistí, zda má hráč klíč (server-side).

|               |                                                          |
| ------------- | -------------------------------------------------------- |
| **Parametry** | `targetSource: number`, `plate: string`, `model: string` |
| **Návrat**    | `boolean`                                                |

```lua
local hasKey = exports['secretrp-vehiclekeys']:GetServerKey(source, plate, model)
```

</details>

### Aliasy

<details>

<summary><strong>GiveKeysServer</strong></summary>

**Popis:** Alias na `GiveServerKeys`.

```lua
exports['secretrp-vehiclekeys']:GiveKeysServer(source, plate, model, false)
```

</details>

<details>

<summary><strong>RemoveKeysServer</strong></summary>

**Popis:** Alias na `RemoveServerKeys`.

```lua
exports['secretrp-vehiclekeys']:RemoveKeysServer(source, plate, model)
```

</details>

<details>

<summary><strong>GetKeyServer</strong></summary>

**Popis:** Alias na `GetServerKey`.

```lua
exports['secretrp-vehiclekeys']:GetKeyServer(source, plate, model)
```

</details>

## Instalace

```cfg
ensure secretrp-vehiclekeys
```

**Závislosti:** `ox_lib`, `ox_target`, `es_extended`, `qs-inventory`, `progressbar`


---

# 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://scripty.secretrp.eu/scripty/secretrp-vehiclekeys/exporty.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.
