meth crafting
Requirements, install steps, items and first start for meth crafting, a FiveM meth script with supply runs, portable tables, player-owned labs and police raids.
With meth crafting (lation_meth), players collect chemicals on supply runs, cook on a portable table in six steps, and buy a warehouse lab that cooks a batch in stages. Each player has their own recipe for 100% purity, a heating table hurts anyone near it without a gas mask, and police can break into a lab and confiscate its equipment. Everything is set in config.lua, with the text in strings.lua.
Works on Qbox, QBCore and ESX.
Requirements
| Resource | Needed | What for |
|---|---|---|
oxmysql | Required | Players, tables and labs |
ox_lib | Required | Callbacks and points, and the default menus, dialogs, notifications, progress bars, skill checks and key prompts |
bob74_ipl | Required | The lab interior: every lab is the biker meth lab |
qbx_core, qb-core or es_extended | Required | Players, jobs, money and usable items |
| An inventory | Required | One that keeps item metadata. See the inventory. |
ox_target, qb-target or interact | Optional | Target options in place of the default key prompts. lation interact works through the ox_target setting. |
lation_ui | Optional | Notifications, progress bars, skill checks, menus and dialogs in the lation ui look. Each starts on ox_lib until you pick it. |
| A dispatch script | Optional | Police calls for toxic smells and power surges: cd_dispatch, ps-dispatch, qs-dispatch, core_dispatch, rcore_dispatch, aty_dispatch, op-dispatch, origen_police or emergencydispatch |
okokNotify, sd-notify or wasabi_notify | Optional | Other notification systems |
fmsdk or fm-logs | Optional | Logs to Fivemanage or Fivemerr |
oxmysql, ox_lib and bob74_ipl are dependencies in fxmanifest.lua: it doesn't start without them. The framework and inventory are detected when it starts; the interaction system, notifications, menus and dispatch are picked in Config.Setup.
The inventory
Ammonia, iodine and acetone carry a fill level from 0 to 100, and liquid meth, trays, boxes and bags carry a purity and a strain. Both are item metadata. The fill level is read as durability on ox_inventory and as quality on qs-inventory and on QBCore.
| Framework | Inventories |
|---|---|
| Qbox | ox_inventory |
| QBCore | ox_inventory, qb-inventory, qs-inventory, ps-inventory, origen_inventory, codem-inventory |
| ESX | ox_inventory or qs-inventory |
On ESX with any other inventory there is no fill level to read, and opening a crate that holds a chemical fails. core_inventory is detected, but a finished lab batch is never put in the lab's stash on it and a sold lab's stash isn't cleared: add it to AddStashItem in bridge/server.lua and ClearStash in server/functions.lua first. On ps-inventory and codem-inventory, the code that empties a sold lab's stash is marked untested.
On ox_inventory, purity and strain show in the item tooltip, and dragging one bottle of ammonia, iodine or acetone onto another of the same pours them together: one fills up to 100 and the other keeps the rest.
Install
Follow the install guide, then:
Keep the folder name lation_meth. The lab pictures and the script's own calls use that name, and a renamed folder prints an error on start and again every 15 minutes.
Add the 13 items and their images to your inventory. The files ship in install/, and the image names match the item names.
Paste the contents of install/items/ox_inventory.txt into ox_inventory/data/items.lua, then copy every file in install/images/ into ox_inventory/web/images/. This is the one to use on Qbox.
Paste the contents of install/items/qb-inventory.txt into qb-core/shared/items.lua, then copy every file in install/images/ into qb-inventory/html/images/.
On QBCore, paste the contents of install/items/qs-inventory.txt into qb-core/shared/items.lua; on ESX, into qs-inventory/shared/items.lua. Then copy every file in install/images/ into its image folder.
Add the same 13 items in your inventory's own format, with the labels and weights in items below, and copy every file in install/images/ into its image folder. The table, the gas mask, the supply crate and the meth are made usable through your framework, so nothing else is needed for them.
Ensure it after its dependencies, your framework, your inventory and anything you pick in Config.Setup. If you run lation ui, it goes first, above ox_lib, because the lation ox_lib fork looks for it when ox_lib starts.
ensure lation_ui # optional
ensure oxmysql
ensure ox_lib
ensure bob74_ipl
ensure qbx_core # your framework
ensure ox_target # optional: or lation_interact / qb-target / interact
ensure ox_inventory # your inventory
ensure lation_methOpen config.lua and set Config.Setup: the interaction system (interact, a key prompt by default), notifications, progress bars, skill checks, menus, dialogs and your dispatch. See setup.
Restart the server.
There is no SQL to import. On every start the script runs the three files in install/, which create its tables when they are missing, so keep the install folder. If a file is gone, the console says install folder or .sql files missing every 10 seconds.
| Table | Holds |
|---|---|
lation_meth_players | Each player's recipe (their ammonia, iodine and acetone values), level, XP, bags produced, supply runs, and the lab they logged out in |
lation_meth_tables | Every placed table: where, whose, its step, timer and purity |
lation_meth_warehouses | Every owned lab: owner, equipment, security, passcode, lock, tank levels, the batch in progress, a pending upgrade, input values and authorized users |
Don't restart lation_meth. Run stop lation_meth, wait a couple of seconds, then ensure lation_meth. Tables, labs and player data are saved as the resource stops, and config.lua warns that a restart can lose them.
Player levels and stats, lab passcodes and door locks are kept in memory and written when a player leaves, when the resource stops and when txAdmin shuts the server down. A crash loses what changed since.
Items
| Item | Label | Weight | Usable |
|---|---|---|---|
ls_meth_table | Meth Table | 1000 | Yes, places the table |
ls_gas_mask | Gas Mask | 150 | Yes, puts the mask on or takes it off |
ls_supply_crate | Supplies | 1000 | Yes, opens the crate |
ls_pseudoephedrine | Pseudoephedrine Pills | 50 | No |
ls_crushed_pseudoephedrine | Crushed Pseudoephedrine | 25 | No |
ls_ammonia | Ammonia | 250 | No |
ls_iodine | Iodine | 250 | No |
ls_acetone | Acetone | 250 | No |
ls_hydrochloric_acid | Hydrochloric Acid | 250 | No |
ls_liquid_meth | Liquid Meth | 225 | No |
ls_meth_tray | Meth Tray | 50 | No |
ls_meth_box | Meth Box | 50 | No |
ls_meth | Meth | 50 | Yes, see using meth |
The labels are the ox_inventory file's. The QBCore and qs files name the pills "Pseudoephedrine", and the qs file calls the crate "Supply Crate". The table, the gas mask and the three chemicals don't stack.
Ammonia, iodine and acetone need their fill level. Supply crates give them full; an item spawned without that metadata stops the script with attempt to compare nil with number when it's used. To hand them out yourself, give ls_supply_crate, or give the chemical with durability (ox_inventory) or quality set to 100.
First start
The three tables are created, and every placed table and owned lab is loaded.
Three blips appear on the map. Meth Supplies at -621.85, 312.42 is William, who starts supply runs. Suspicious Person at 2380.10, 3348.92 is James, who hands out the table. Warehouse Shop at -104.41, 976.09 is Benjamin, who sells the labs.
Talk to James for a table, then to William for a supply run, and follow cooking.
Read through config.lua and set prices, timers, yields and places. See configuration.
There's no admin panel and no admin command. With Config.Setup.debug on, /getrot copies your rotation to the clipboard for a lab's camrot, and the server console gets getbucket, resetbucket and getplayersinwarehouse. They have no permission check, so keep debug off on a live server.
Troubleshooting
The console says to rename the folder
The resource folder isn't named lation_meth. Rename it back and restart; the message repeats every 15 minutes until you do.
SCRIPT ERROR: attempt to compare nil with number
A bottle of ammonia, iodine or acetone has no fill level, usually because it was spawned. Give supply crates instead, or the chemical with its durability or quality set. On ESX, use ox_inventory or qs-inventory. See the inventory.
The console says install folder or .sql files missing
The install folder or one of its .sql files was deleted. Put them back: the tables are created from them on every start.
No such export ClearStash in resource qb-inventory
Your qb-inventory is out of date. Update it to the current release.
Nothing happens near William, James or Benjamin
With a target system picked in Config.Setup.interact, that resource has to be running before lation_meth. With the default textui, walk up to the ped and press E when the prompt shows.
Progress or levels were lost after a restart
Restart the resource with stop and ensure, never restart, and let txAdmin shut the server down. Data is written as the resource stops; a crash loses what changed since the last save.
The console says Unable to fetch version information from API
The update check couldn't reach the version server. It changes nothing in game. Set Config.Setup.version to false to skip it.
Still stuck? Ask in our Discord: the people who write the scripts answer.
Last updated