Installation

# Installation Guide

To ensure Janto Phone runs smoothly, you must follow the steps below in order. Janto Phone is built on a high-performance infrastructure and requires specific dependencies.

## Requirements

Before starting the installation, make sure the following libraries are installed and up-to-date on your server:

- [ox_lib](https://github.com/overextended/ox_lib) (Mandatory)

- [oxmysql](https://github.com/overextended/oxmysql) (Mandatory)

- [pma-voice](https://github.com/AvarianKnight/pma-voice) (Mandatory for calls)

- [screenshot-basic](https://github.com/citizenfx/screenshot-basic) (Required for taking photos)

> **Note:** Advanced Audio and Render engines are included in the package as `janto-sound` and `janto-render` for maximum performance.

---

## Step 1: Database Installation

Janto Phone uses MariaDB to store data.

1.  Find the `janto-phone.sql` file in the application folder.

2.  Run this SQL file in your database using HeidiSQL or your preferred database management tool.

---

## Step 2: Resource Installation (One-Click)

1.  Extract the downloaded zip file.

2.  Drag and drop the entire `[janto]` folder into your server's `resources` directory.

3.  That's it! The package includes `janto-phone` (Core), `janto-ui` (Interface), `janto-sound` (Audio), and `janto-render` (Video/Camera).

---

## Step 3: server.cfg Configuration

Add the following lines to your server configuration file (`server.cfg`), ensuring they come **after** the dependencies:

```cfg

# Dependencies

ensure ox_lib

ensure oxmysql

ensure pma-voice

ensure screenshot-basic

# Janto Suite (Order is important)

ensure [janto]

# OR explicitly:

# ensure janto-sound

# ensure janto-render

# ensure janto-ui

# ensure janto-phone

```

---

## Step 4: Voice System Settings (pma-voice)

Correctly configuring `pma-voice` settings in `server.cfg` is critical for calls and the radio system to work properly:

```cfg

setr voice_useNativeAudio true

setr voice_use2dAudio false

setr voice_use3dAudio true

setr voice_useSendingRangeOnly true

```

---

## Step 5: External Services and API Settings

For features like camera, gallery, and gif to work at full performance, external services must be configured.

1.  Open the `config/apiKeys.lua` file.

2.  Enter the API keys for the services you want to use into the relevant fields.

| Service | File Location | Description |

| :--- | :--- | :--- |

| **Image (Fivemanage)** | `APIKeys.Fivemanage` | Required to upload photos/videos to the Gallery. (Mandatory) |

| **GIF (Giphy)** | `APIKeys.Giphy` | Required to search for GIFs in messages and social media. (Optional) |

| **Music (iTunes)** | `APIKeys.iTunes` | Music search service. Does not require a key, you can configure regional settings here. |

```lua

-- Example: config/apiKeys.lua

APIKeys.Fivemanage = {

    Enabled = true,

    APIKey = 'YOUR_FIVEMANAGE_API_KEY_HERE', -- https://fivemanage.com

    MaxFileSizeMB = 10,

}

```

---

## Step 6: License Key

Janto Phone is licensed with a dual-layer system using both FiveM-based **Escrow** and the **Janto Guard** system. You must enter the license key sent to you via Discord after purchase for the script to work.

1.  Copy your license key from your post-purchase Discord DM.

2.  Open the `config/config.lua` file.

3.  Paste this key into the `Config.LicenseKey` field.

```lua

Config.LicenseKey = 'JANTO-XXXX-XXXX-XXXX' -- Key from Discord DM

```

---

## Step 7: Framework Detection

Janto Phone automatically detects ESX, QBCore, and QBox frameworks. You don't need to make any extra settings, but if you want manual intervention, check the `config/config.lua` file.

```lua

Config.Framework = 'auto' -- 'esx', 'qbcore', 'qbox' or 'auto'

```

---

## Step 8: Inventory Integration

Janto Phone comes with the **Unique Phone (Metadata)** system by default (`Config.UniquePhones = true`). For this feature to work, you need to correctly define the `phone` item in your inventory script.

::: details ox_inventory

Add the following definition to `ox_inventory/data/items.lua` or update the existing `phone` item:

```lua

['phone'] = {

    label = 'Smartphone',

    weight = 190,

    stack = false, -- VERY IMPORTANT: Must be false to avoid metadata mixing

    close = true,

    description = 'A latest model smartphone.',

    client = {

        export = 'janto-phone.UsePhone' -- To open when used

    }

},

```

:::

::: details QB-Core / QB-Inventory

Ensure the `unique` value of the `phone` item is `true` in `qb-core/shared/items.lua`:

```lua

['phone'] = {

    ['name'] = 'phone', 

    ['label'] = 'Smartphone', 

    ['weight'] = 200, 

    ['type'] = 'item', 

    ['image'] = 'phone.png', 

    ['unique'] = true, 

    ['useable'] = true, 

    ['shouldClose'] = true, 

    ['combinable'] = nil, 

    ['description'] = 'Used to communicate.'

},

```

:::

::: details ESX (es_extended)

If you are not using ox_inventory, after adding the `phone` item to the database (`items` table), you must execute the following definition on the server side (in any script):

```lua

ESX.RegisterUsableItem('phone', function(source)

    -- Event triggered when phone is used

    TriggerEvent('janto:phone:usePhoneItem', source)

end)

```

:::

::: details vRP

For item definition and usage in vRP infrastructure, add to `vrp/cfg/items.lua` or your relevant item file:

```lua

-- vRP Item Definition

["phone"] = {"Smartphone", "Used to communicate.", function(choices)

    local player = choices.player

    -- Event triggered when phone is used

    TriggerEvent("janto:phone:usePhoneItem", player)

end, 0.2}

```

:::

---

## Update Guide

To avoid data loss when updating Janto Phone to a new version, follow these steps.

### 1. Backup

Always create a backup before starting the update process.

- **Resource Backup:** Backup your existing `janto-phone` folder (e.g., by zipping it).

- **Database Backup:** Backup your database using HeidiSQL or a similar tool (`Export database as SQL`). This step is optional but always recommended if no database changes are mentioned in the update notes.

### 2. Remove Old Version

Stop your server and completely delete the old `janto-phone` folder from your `resources` directory.

> **Note:** Do not overwrite; old file remnants may cause issues.

### 3. Install New Version

Download the latest version of `janto-phone` from your Keymaster account and place it in the `resources` folder.

### 4. Configuration

Check your old `config` files (especially `config.lua` and `apiKeys.lua`) and transfer them to the new version.

> **Important:** If the config structure has changed in the new version, it is recommended to edit the values on the new config file instead of copying the old one directly. Changes are usually specified in the update notes.

---

> [!TIP] Tip

> The default key to open the phone in-game is **F1**. You can change the key binding via `config.lua`.