legacy-crafting
Installation
Dependencies, database setup, and NUI build steps.
Installation
1. Dependencies
Install and start these resources before legacy-crafting:
| Resource | Required | Notes |
|---|---|---|
legacy-lib |
Yes | Provides Framework, Inventory, locale/accent helpers, webhook sender, version check, and the Target wrapper used by client/benches.lua. Must start before legacy-crafting or the exports['legacy-lib']:Target() call at file load will fail. |
ox_lib |
Yes | Used for lib.callback (all server exports are lib.callbacks) and lib.progressBar (crafting animation). |
oxmysql |
Yes | All database access (MySQL.query/insert/update). |
ox_inventory |
Yes (runtime) | The craft callback calls exports.ox_inventory:Search / RemoveItem directly, bypassing the Inventory wrapper, even in non-storage mode. |
ox_target |
Yes (runtime) | Used directly for existing-prop bench zones (addSphereZone), and indirectly (via legacy-lib's Target wrapper) for spawned-prop benches. |
legacy-skills |
Optional | Only required if Config.UseSkillsResource = true. Not listed as a formal dependency but required at runtime in that mode — start it before legacy-crafting or XP calls will fail/behave unexpectedly. |
Suggested server.cfg load order
ensure oxmysql
ensure ox_lib
ensure legacy-lib
ensure ox_inventory
ensure ox_target
ensure legacy-skills
ensure legacy-crafting
2. Database
Run the schema once against your database:
mysql -u user -p database < sql/schema.sql
This creates all 9 legacy_crafting_* tables and seeds default tiers, sample categories, sample recipes, and sample ingredients.
⚠️
sql/schema.sqlbegins withDROP TABLE IF EXISTSon everylegacy_crafting_*table. Only run it on a fresh database or when you intend a full reset — it destroys all existing benches, recipes, XP, cooldowns, and history with no backup.
Optional seed data
sql/seed_gun_recipes.sql— adds "Small Guns" / "Big Guns" categories with pistol/rifle recipes. Idempotent (safe to re-run), but re-running discards manual edits to those same recipes since it deletes-then-reinserts byoutput_item.sql/seed_heists_and_weapons.sql— bulk seed of heist tools, electronics, demolitions, field kit, and every in-game weapon hash across 11 categories. Also idempotent via an upfrontDELETE ... WHERE output_item IN (...)block. Adjust base material item names (metalscrap,electronickit,steel, etc.) to match your inventory before running.sql/update_lvl1_zero_xp.sql— one-off update settingrequired_level=1, xp_reward=0forbag,binoculars,x_laptop,x_device. Safe to re-run; matches byoutput_itemstring.
Both seed files must be run after schema.sql, since they insert into tables it creates.
After seeding recipes, you still need to attach them to a bench — either through the admin panel (Config.AdminCommand) or by inserting rows into legacy_crafting_bench_recipes directly. Seeding recipes alone does not make them craftable anywhere.
3. Build the NUI
The admin/crafting UI is a separate React/Tailwind/Vite project under web/ that must be built before the resource will display anything in-game:
cd web
npm install
npm run build
# outputs to web/dist, which the resource's NUI loads
web/vite.config.js sets base: './' — required for assets to load inside the FiveM CEF browser. Do not change this to an absolute path.
4. Locale
Make sure Config.Locale (default 'en') matches a file in locales/ (e.g. 'en' → locales/en.json). There is no fallback if a key is missing, so custom locales must mirror all keys in the shipped en.json.