π Sell Drugs
Access a comprehensive guide that includes a detailed installation process, examples of code, previews of configurations.
INSTALLATION GUIDE
Step 0 - First Steps
Download is_selldrugs from KeyMaster and install is_bridge & is_lib.
Step 1 - Configure Resource
You must read and configure the config.lua
file in is_selldrugs to meet your needs.
Step 2 - Adding Items
For the script to function correctly, it's essential to add specific items to your game's database. This section guides you through adding these items, particularly focusing on the phone item and new drugs.
- Adding a Phone Item
To use the Trap Phone and receive wholesale orders, you first need to add the phone to your engine (QBCore/ESX). The item name for the Trap Phone should match the one specified in config.lua
(default trap_phone
). You can download the image for the Trap Phone that we use from here.
Adding a Trap Phone to ESX Framework
Access the Database: Log in to your server's database management tool (like phpMyAdmin).
Navigate to the
items
Table: In your database, find theitems
table. This is where all the items for the game are defined.Insert New Item: Add a new entry for the
trap_phone
. You can do this manually using the tool's interface, or you can run an SQL command.SQL Command for Adding Trap Phone: To quickly add the item, execute the following SQL command:
name
: 'trap_phone' (This is the identifier used in your script)label
: 'Trap Phone' (The display name for the item)weight
: 1 (The weight of the item)rare
: 0 (Indicates the rarity, 0 for common)can_remove
: 1 (Whether the item can be removed from inventory)
Adding a Trap Phone to QB-Core Framework
Edit the QB-Core Shared File:
Navigate to the
qb-core
folder.Open the
shared/items.lua
file.Add a line for the new item in the items list. For example:
This line defines the item's properties like name, label, weight, and image file.
Add Image to QB-Inventory:
Go to the
qb-inventory
folder.Place the image for the item in the appropriate directory (usually in
html/img
).Ensure the image file name matches the one specified in the shared file (
trapPhone.png
).
- Adding a Drugs Item
In the config.lua
file, you need to configure the list of items that players can sell. You need to provide data such as the item name, wholesale price, and retail price. When adding a new drug, you also need to add its image, for example, from your inventory system. To do this, you need to obtain the item image (.png), then name it the same as the drug name, and move it to is_selldrugs/html/img/inventory
.
Step 3 - SQL Database
For the script to work correctly, it needs integration with the database. You can add it using the following SQL command or import the SQL file provided with the script.
Step 4 - Install Dependencies
To use the script, the following resources are required:
is_lib - and resources compatible with this library, such as framework, inventory, target
Using a Trigger instead of a Command
In config.lua
, set the value in the cfg.commands.status
table to nil
to disable the command. Once you've done that, use a Trigger to activate/deactivate retail sales.
Adding to Radial Menu
The above triggers may not work because some scripts, such as qb-radialmenu, send information about a table in the argument instead of the arguments or player ID we send. This can be solved by adding the following code to config.lua
. We use it with the trigger type client
and paste the trigger name, which is is_selldrugs:radialMenu
.
Last updated