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

# Client Exports

{% tabs %}
{% tab title="Tab 1" %}

* <sup>exports\['Kz-VehicleAFK']:ExportName(arguments)</sup>
  {% endtab %}
  {% endtabs %}

#### Available Exports

| Export                     | Description                                                                                                             | Arguments             | Returns                                    |
| -------------------------- | ----------------------------------------------------------------------------------------------------------------------- | --------------------- | ------------------------------------------ |
| **IsAFK()**                | Checks if the player is currently in cinematic AFK mode.                                                                | None                  | `boolean` (`true` / `false`)               |
| **StartAFK()**             | Manually starts the cinematic camera. The player must be inside a vehicle.                                              | None                  | `boolean` (`true` if successfully started) |
| **StopAFK()**              | Stops the cinematic camera and restores the player's normal view.                                                       | None                  | `nil`                                      |
| **ToggleAFK()**            | Toggles the cinematic AFK camera state.                                                                                 | None                  | `boolean` (new state after toggle)         |
| **IsAFKEnabled()**         | Checks whether the automatic AFK detection system is enabled.                                                           | None                  | `boolean`                                  |
| **SetAFKEnabled(enabled)** | Enables or disables the automatic AFK detection system. If disabled, any active cinematic camera will stop immediately. | `enabled` (`boolean`) | `boolean` (new state)                      |

## 💻 Export Usage Examples

```lua
-- Start the cinematic camera manually
exports['Kz-VehicleAFK']:StartAFK()

-- Disable the automatic AFK system
exports['Kz-VehicleAFK']:SetAFKEnabled(false)

-- Check if the player is currently AFK
if exports['Kz-VehicleAFK']:IsAFK() then
    print("Player is currently watching the cinematic camera.")
end
```

## 🔔 Events

The resource provides events that other scripts can listen to when the AFK state changes.

> #### Event List

| Event Name                  | Description                                                   | Parameters        |
| --------------------------- | ------------------------------------------------------------- | ----------------- |
| **kryzan-afk:stateChanged** | Triggered when the player enters or exits AFK cinematic mode. | `isAFK (boolean)` |

## Event Example

AddEventHandler('kryzan-afk:stateChanged', function(isAFK)

```lua
AddEventHandler('kryzan-afk:stateChanged', function(isAFK)
    if isAFK then
        -- Example: Hide custom HUD elements
        print("[HUD Manager] AFK started: Hiding HUD.")
    else
        -- Example: Show custom HUD elements again
        print("[HUD Manager] AFK ended: Restoring HUD.")
    end
end)
```
