# Installation

This guide describes the full installation process and the initial setup of the **17mov\_Phone** resource.\
The script is designed to require as few manual steps as possible - most configuration tasks are handled automatically.

***

{% stepper %}
{% step %}

### Downloading and adding the resource

1. Download the resource from the official [**Cfx.re portal**](https://portal.cfx.re/).
2. Extract the downloaded package.
3. Move the entire folder: `17mov_Phone` into your server’s: `resources` directory.
4. Add the following line to your `server.cfg` to start the resource: `ensure 17mov_Phone`. This guarantees the script will load automatically on every server restart.
   {% endstep %}

{% step %}

### Add Inventory Items

The next step is to add the required items:&#x20;`simcard`, `phone`, and `broken_phone`.

Follow the guides below for your specific framework or inventory system:

{% tabs %}
{% tab title="qb-core" %}

1. Go to your qb-core folder.
2. Open the file: /shared/items.lua
3. Scroll to the end of the file.
4. Before the closing } add the following code:

```lua
    phone                        = { name = 'phone', label = 'Phone', weight = 700, type = 'item', image = 'phone.png', unique = true, useable = true, shouldClose = false, description = 'Phone' },
    simcard                      = { name = 'simcard', label = 'SIM Card', weight = 1, type = 'item', image = 'simcard.png', unique = true, useable = true, shouldClose = false,  description = 'Use to install in your phone' },
    broken_phone                 = { name = 'broken_phone', label = 'broken_phone', weight = 700, type = 'item', image = 'broken_phone.png', unique = true, useable = false, shouldClose = false, description = 'Broken Phone' },
```

{% endtab %}

{% tab title="DEFAULT ESX" %}

1. Run this SQL query in your database:

```
    INSERT IGNORE INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES
        ('phone', 'Phone', 1, 0, 1),
        ('simcard', 'Sim card', 1, 0, 1),
        ('broken_phone', 'Broken Phone', 1, 0, 1),
    ;
```

{% endtab %}

{% tab title="ox\_inventory" %}

1. Go to your ox\_inventory folder.
2. Open modules/items/client.lua
3. Find and remove this code:  (Usually around 132 line)<br>

   ```lua
   Item('phone', function(data, slot)
   	local success, result = pcall(function()
   		return exports.npwd:isPhoneVisible()
   	end)
   	
   	if success then
   		exports.npwd:setPhoneVisible(not result)
   	end
   end)
   ```
4. Go back to main ox\_inventory folder and open the file: /data/items.lua
5. Scroll to the end of the file.
6. Before the closing } add the following code:

```lua
    ['phone'] = {
        label = 'Phone',
        weight = 150,
        client = {
            image = 'phone.png',
        },
        server = {
            export = '17mov_Phone.phone'
        },
        consume = 0,
        stack = false
    },

    ['simcard'] = {
        label = 'Sim Card',
        weight = 150,
        client = {
            image = 'simcard.png',
        },
        server = {
            export = '17mov_Phone.simcard'
        },
        consume = 0,
        stack = false
    },

    ['broken_phone'] = {
        label = 'Broken Phone',
        weight = 150,
        client = {
            image = 'broken_phone.png',
        },
        consume = 0,
        stack = false
    },

```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
**IMPORTANT:** Before adding items, ensure that the "phone" item didn't **previously exist** in your framework. In QB-Core, ox\_inventory, and many other popular inventories, it is already defined. Before adding ours, first remove your current phone; otherwise, the script likely won't work at all.
{% endhint %}
{% endstep %}

{% step %}

### Installing images into your inventory system

Inside the resource you will find: `installation/images` This folder contains example icons meant for integration with the inventory system used on your server (e.g., qb-inventory, ox\_inventory, etc.).

**Steps:**

1. Copy all files from the `installation/images` folder.
2. Paste them into the assets folder of your inventory system, for example:

| qb-inventory | ox\_inventory | ps-inventory | esx\_inventory  |
| ------------ | ------------- | ------------ | --------------- |
| /html/images | /web/images   | /html/images | /html/img/items |

> You can use your own custom icons if you want to keep your server’s unique visual style.
> {% endstep %}

{% step %}

### Database installation

The database structure is created **automatically** on the first start of the script. If the script detects that required tables do not exist, it will create them automatically.
{% endstep %}

{% step %}

### First launch of the phone

After a successful installation:

1. Join your server.
2. Give your character the required items: `phone`&#x20;
3. You can open the phone in two ways:

**From your inventory:**

Use the `phone` item directly inside your inventory.

**Using a keybind:**

Default key: `tilde`. This key opens the **last used** phone assigned to the player.

{% endstep %}

{% step %}

### Configure Api Keys

This step is optional, but skipping it may cause some apps, like the camera or video calls, to malfunction. We described this section later in [Configure ApiKeys](https://docs.17movement.net/phone/configure-apikeys)
{% endstep %}

{% step %}

### Done! 🎉

After completing all steps, the script is fully operational and ready to use on your FiveM server.

### Migrating data from your previous phone system

If you previously used a different phone script, it is possible to transfer selected data (such as contacts, messages, photos, SIM numbers, etc.) into the new **17mov\_Phone** system.

Migration options and supported formats are described in next page

{% endstep %}
{% endstepper %}
