π Sell Drugs
Access a comprehensive guide that includes a detailed installation process, examples of code, previews of configurations.
Links:
INSTALLATION GUIDE
Step 0 - First Steps
1. Download your resource from FiveM's Keymaster
2. Unzip the inside-selldrugs
folder and place this folder in your server's resource folder.
3. Add the resource to your server start config (server.cfg): ensure inside-selldrugs
If you are using a framework, it must be placed anywhere below your framework resource e.g., es_extended, not above.
ensure es_extended ensure inside-selldrugs
Step 1 - Configure Resource
You MUST read all configurable options inside the[inside-selldrugs/config.lua]
file and configure them to suit your server's needs.
# cfg.Time
Zone
specifies whether your time zone is ahead (plus
) or behind (minus
) GMT.
Zone_Count
sets how many hours you are from GMT. For example, for GMT+1, setZone
to "plus" andZone_Count
to 1.
Format
decides if time is in 24-hour (set to 24) or 12-hour AM/PM format (set to 12).
# cfg.Drug_List
cfg.Drug_List
defines default prices for drugs like "cokebaggy", "meth", etc. Each has an average_price
for retail. Wholesale prices are typically half this amount.
Ensure these items are added to your item database to make them accessible in-game.
When adding new items, place their images in inside-selldrugs/html/img/inventory/
, naming the file as item_name.png
. This ensures the correct display of the drug's image in the game.
# cfg.Phone
cfg.Phone
sets up phone items in the game. It specifies the Price
as 500 and the Item_Name
as "trap_phone". Ensure "trap_phone" is already added as an item in your item database for it to spawn correctly in-game.
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
The script requires a phone item to be added to your database. This item is crucial for various script functionalities.
Adding a New Item to ESX Framework
To add a new item, such as a 'trap phone', to your ESX server, follow these steps:
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:
This command inserts a new item with the following properties:
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)
Update Script Configuration: In your
config.lua
, set the phone item's name to match the one you've added to the database, in this case, 'trap_phone'.
Adding a New Item to QB-Core Framework
To add a new item, such as a 'trap phone', to your QB-Core server, follow these steps:
Edit the QB-Core Shared File:
Navigate to the
qb-core
folder.Open the
shared
folder.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
).
Restart the Server:
After making these changes, restart your FiveM server.
This is necessary for the server to recognize and load the new item configuration.
- Adding a Drugs Item
For ESX:
Database Entry: As with the 'trap_phone', add the new drug item to your ESX server's database using an SQL command. Adjust the
name
,label
, and other properties for the drug item.
For QB-Core:
Shared File Update: Follow the same process as for the 'trap phone' in QB-Core. Add your drug item in the
shared
folder ofqb-core
, customizing the properties. Setuseable
tofalse
for drugs, unless they have a specific use case in the game.Image Addition: Place the drug image in the
qb-inventory
directory.
Common Steps:
Update Script Configuration: For QB-Core, add the new drug to
cfg.Drug_List
.Restart the Server: After making these changes in either framework, restart your server to implement the new items.
Step 3 - SQL Database
To set up your database for the game, you'll need to create two tables:selldrugs_players
andselldrugs_phone
. Use the following SQL commands to create these tables:
Step 4 - Install Dependencies
For the script to function properly, it requires the resources listed below.
To avoid any issues with the script's performance, ensure that you're using the Latest Version of the Framework or Previous Versions that include the same features.
QBCORE
qb-target or ox_target (ox_lib for ox_target also)
oxmysql - Currently available in the latest version of the Framework
ESX
qb-target or ox_target (ox_lib for ox_target also)
oxmysql - Currently available in the latest version of the Framework
How can I change my notifications?
To properly set up the clientNotify
and serverNotify
functions in your FiveM script, follow these steps:
Identify Your Notification System: First, determine the notification system your server uses.
Learn How to Trigger Notifications: Once you've identified the notification system, find out how to trigger these notifications. Look for documentation or examples in your existing scripts. Pay attention to the format and arguments required for triggering notifications.
Modify the Notification Functions:
In
clientNotify
andserverNotify
, replaceQBCore:Notify
oresx:showNotification
with the appropriate event or function call from your notification system.Ensure you fill in the arguments correctly. Each notification system has its specific requirements for message text, notification type, duration, and possibly other parameters.
Test Your Notifications: After setting up, test the notifications in various scenarios to confirm they work correctly. This helps ensure that players receive the right messages at the right time.
Custom event (radial menu)
If someone doesn't want to use a command or doesn't like it, you can add event triggering to your e.g. radial menu.
Last updated