VNS Crafting System
A workbench crafting script for FiveM with an NUI crafting menu. Players walk up to a workbench, press E, pick a recipe and wait out a timer while the item is assembled. Each workbench carries its own set of recipes, so a public bench can offer lockpicks while a hidden container in the desert crafts rifles.
One resource runs on QBCore, QBox and ESX. Framework, inventory, target, notification and item-image support comes from vns-core.
Feature overview
- Per-bench recipe sets - every workbench lists exactly the recipes you assign to it. The same recipe can appear on several benches.
- Two bench types - a plain workbench (a point in the world), or a container: the script spawns a shipping container with workbench props and a door that players lock and unlock with a key item through your target system.
- Crafting levels - each recipe has an XP requirement. Crafting XP is stored in the script's own database table, so it works the same on every framework. Recipes can grant XP per craft, and admins can set XP with
/setxp. - Server-side checks - the server verifies the bench, distance, time window, level and ingredients before removing anything, and only hands out the result once its own timer has run out.
- Key durability - optionally, every lock/unlock of a container door costs the key durability until it breaks.
- Time windows - individual recipes can be limited to certain server hours (e.g. weapon crafting only at night).
- Crafting survives a relog - a player who disconnects mid-craft picks the timer back up on their next login.
- Distance pause - the timer only counts down while the player stays near the bench.
How a craft plays out
- The player stands at a workbench (within 1 m) and presses E.
- The NUI menu opens with the recipes of that bench.
- The player picks a recipe. The server checks level and ingredients, removes the ingredients and starts the timer.
- A timer overlay counts down while the player stays within
Config.DistanceToCraftof the bench. - When the timer hits zero the server adds the crafted item and any configured XP.
Only one craft can run per player at a time.
Open vs Encrypted
The script ships in an Open and an Encrypted variant. In the Encrypted variant config.lua, client/client_open.lua and server/server_open.lua stay editable - all recipes, workbenches, texts, the /setxp command, the crafting level storage and the key durability functions live there.