Installation
Installation
Four steps: import the SQL, give yourself access to the editor, register your items, start the resource.
1. Dependencies
| Resource | Required | Why |
|---|---|---|
ox_lib |
Yes | Callbacks, notifications, locales |
oxmysql |
Yes | Storing substances and player addiction state |
| A targeting resource | Optional | Examining a player without a command |
2. server.cfg — ensure order
Start bupa-addictioncreator after the resources it depends on.
ensure ox_lib
ensure oxmysql
ensure ox_target
ensure bupa-addictioncreator3. Database
Import sql/bupa_addictioncreator.sql. It creates two tables:
| Table | Holds |
|---|---|
bupa_substances |
The substance definitions you build in the editor |
bupa_addictions |
Per-character addiction level, tolerance, dose count and history |
Both names can be changed under Config.Tables if they clash with something you already run.
4. Access to the editor
The editor changes what drugs do on your server, so it is gated.
add_ace group.admin bupa.substances allowOn a dev server where nobody has set ACEs up yet, put your licence identifier in the config instead:
Config.Creator = {
Command = 'substances',
UseAce = true,
Ace = 'bupa.substances',
Developers = { 'license:0000000000000000000000000000000000000000' },
LivePreview = true,
}5. Register your items
Every substance you build in the editor points at an inventory item, and that item has to exist. Copy the block for your inventory out of the matching file in install/inv/:
| File | Covers |
|---|---|
inv/ox_inventory.txt |
ox_inventory |
inv/qb-inventory.txt |
qb-inventory, lj-inventory, ps-inventory |
inv/qs-inventory.txt |
qs-inventory |
inv/codem-inventory.txt |
codem-inventory |
inv/tgiann-inventory.txt |
tgiann-inventory |
inv/esx.txt |
classic ESX inventories |
For ox_inventory, two lines in that entry matter:
['meth_syringe'] = {
label = 'Meth',
weight = 20,
stack = true,
close = true,
consume = 0,
description = 'A loaded syringe',
client = { image = 'meth_syringe.png' },
server = { export = 'bupa-addictioncreator.useSubstance' },
},server.export— ox_inventory has noCreateUseableItem, so this export is how the resource learns the item was used.consume = 0— without it, ox_inventory removes the item before the resource has decided whether the dose is allowed. The resource removes the item itself, once it has.
On QBox, QB-Core and ESX the resource registers the usable item itself through the core, so useable = true on the item is all that is needed.
The item name in the editor and the item name in your inventory must match exactly, in lower case. The editor lower-cases what you type; your items file has to agree.