> For the complete documentation index, see [llms.txt](https://docs.17movement.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.17movement.net/phone/battery-system.md).

# Battery System

## Installation

{% stepper %}
{% step %}

### Enable battery system in config

1. Open `configs/Config.lua`
2. Set `Config.BatterySystem = true`&#x20;
   {% endstep %}

{% step %}

### Add required items

Next step is to add 3 new default items `powerbank_small`, `powerbank`, `powerbank_pro` in your inventory.

{% 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
["powerbank_small"] = { name = 'powerbank_small', label = 'Small Powerbank', weight = 700, type = 'item', image = 'powerbank_small.png',  unique = true, useable = false, shouldClose = false, description = 'A compact powerbank, fits right in your pocket.' },
["powerbank"]       = { name = 'powerbank',       label = 'Powerbank',       weight = 700, type = 'item', image = 'powerbank.png',        unique = true, useable = false, shouldClose = false, description = 'A reliable powerbank to keep your devices charged on the go.' },
["powerbank_pro"]   = { name = 'powerbank_pro',   label = 'Powerbank Pro',   weight = 700, type = 'item', image = 'powerbank_pro.png',    unique = true, useable = false, shouldClose = false, description = 'High-capacity powerbank for those who never want to run out of juice.' },
```

{% endtab %}

{% tab title="esx default" %}

1. Run this SQL query in your database:

```sql
INSERT IGNORE INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES
        ('powerbank_small', 'Small Powerbank', 1, 0, 1),
        ('powerbank', 'Normal Powerbank', 1, 0, 1),
        ('powerbank_pro', 'Powerbank Pro', 1, 0, 1),
        ('powerbank_small_discharged', 'Discharged Small Powerbank', 1, 0, 1),
        ('powerbank_discharged', 'Discharged Normal Powerbank', 1, 0, 1),
        ('powerbank_pro_discharged', 'Discharged Powerbank Pro', 1, 0, 1);
```

{% endtab %}

{% tab title="ox inventory" %}

1. Go to your ox\_inventory folder.
2. open the file: `/data/items.lua`
3. Scroll to the end of the file.
4. Before the closing } add the following code:

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

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

['powerbank_pro'] = {
    label = 'Powerbank Pro',
    weight = 150,
    client = {
        image = 'powerbank_pro.png',
    },
    server = {
        export = '17mov_Phone.powerbank_pro'
    },
    consume = 0,
    stack = false
},
```

{% endtab %}
{% endtabs %}
{% 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 powerbank images 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 |
| {% endstep %}    |               |              |                 |
| {% endstepper %} |               |              |                 |

After these steps, battery system should be working. You can configure everything related to Battery System inside `configs/Config.lua`, including custom powerbanks, battery lifespan and more.&#x20;

## Exports

### Server

#### ToggleCharging

Toggles charging phone with active number

**params:**

<table><thead><tr><th width="145" align="center" valign="middle">Argument</th><th align="center">Type</th><th align="center">Optional</th><th align="center">Explanation</th></tr></thead><tbody><tr><td align="center" valign="middle"><code>src</code></td><td align="center"><code>number</code></td><td align="center">❌</td><td align="center">The player's server ID (source).</td></tr><tr><td align="center" valign="middle"><code>state</code></td><td align="center"><code>boolean</code></td><td align="center">❌</td><td align="center">Set true to start chargingg, false to stop charging</td></tr><tr><td align="center" valign="middle"><code>chargeValue</code></td><td align="center"><code>number</code></td><td align="center">✅</td><td align="center">How fast phone will be charged (default 10000)</td></tr></tbody></table>
