π Sell Drugs
Access a comprehensive guide that includes a detailed installation process, examples of code, previews of configurations.
Last updated
Access a comprehensive guide that includes a detailed installation process, examples of code, previews of configurations.
Last updated
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
).
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 the items
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
).
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
.
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.
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
.
- and resources , such as framework, inventory, target