๐Ÿ”‹Battery System

This page describes how to enable and configure battery system

Installation

1

Enable battery system in config

  1. Open configs/Config.lua

  2. Set Config.BatterySystem = true

2

Add required items

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

  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:

["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.' },
3

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

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.

Exports

Server

ToggleCharging

Toggles charging phone with active number

params:

Argument
Type
Optional
Explanation

src

number

โŒ

The player's server ID (source).

state

boolean

โŒ

Set true to start chargingg, false to stop charging

chargeValue

number

โœ…

How fast phone will be charged (default 10000)

Last updated