Exports

Available exports for you to utilise for Possible Crafting.

Benches and recipes can be managed and created in the Crafting config file. However, you can also create benches and recipes dynamically using the following exports.

RegisterBench

This export is used to register a new crafting bench from your external resource.

Lua
local success, err = exports['possible-crafting']:RegisterBench({    id = 'ballas_drug_lab',              -- Unique identifier (required)    label = "Drug Lab",                   -- Display name (required)    coords = vec3(1234.5, -567.8, 30.0), -- Location (required) - can also be a table of vec3 for multiple locations    radius = 2.0,                         -- Interaction radius (use this OR length/width/heading)    -- length = 2.0,                      -- Box zone length (alternative to radius)    -- width = 1.5,                       -- Box zone width    -- heading = 45.0,                    -- Box zone rotation    gang = 'ballas',                      -- Restrict to gang(s) - string or table (optional)    job = 'drugdealer',                   -- Restrict to job(s) - string or table (optional)    useCategories = true,                 -- Use category-based recipe filtering    categories = {        drugs = { label = "Drugs", skill = "chemistry" }  -- Category with associated skill    },    emote = 'yourEmoteName',              -- Emote to play while crafting (optional)    blip = {                              -- Map blip settings (optional)        enable = true,        sprite = 140,        colour = 1,        scale = 0.8,        label = "Drug Lab"    },    debug = false                         -- Show debug zone (optional)})
if not success then    print('Failed to register bench: ' .. err)end

📥 Parameters

NameTypeRequiredDescription
idstring✅Unique identifier for the bench.
labelstring✅Display name shown in the UI.
coordsvec3 or table✅Location coordinates. Can be a single vec3 or table of vec3 for multiple locations.
radiusnumber❌Interaction radius (use this OR length/width/heading for box zones).
lengthnumber❌Box zone length (alternative to radius).
widthnumber❌Box zone width (requires length).
headingnumber❌Box zone rotation (requires length/width).
gangstring or table❌Restrict access to specific gang(s).
jobstring or table❌Restrict access to specific job(s).
useCategoriesboolean❌Enable category-based recipe filtering.
categoriestable❌Category definitions with labels and optional skill requirements.
emotestring❌Emote to play while crafting.
bliptable❌Map blip settings (enable, sprite, colour, scale, label).
debugboolean❌Show debug zone visualization.

📤 Returns

NameTypeDescription
successbooleanWhether the bench was registered successfully.
errstringError message if registration failed.

RegisterRecipe

This export is used to register a new crafting recipe from your external resource.

Lua
local success, err = exports['possible-crafting']:RegisterRecipe({    key = 'meth_bag',                     -- Unique identifier (required)    label = "Meth Bag",                   -- Display name (required)    category = "drugs",                   -- Category for bench matching (required)    output = {                            -- What the player receives (required)        item = "meth",        count = 1,        metadata = {}                     -- Optional metadata    },    ingredients = {                       -- Required items to craft (required)        pseudoephedrine = 2,        chemicals = 1    },    time = 10000,                         -- Crafting time in milliseconds (required)    levelRequired = 1,                    -- Minimum skill level required (optional, default 0)    xpReward = 10,                        -- XP gained on craft (optional)    emote = 'yourEmoteName',              -- Emote override for this recipe (optional)}, { 'ballas_drug_lab' })                 -- Optional: restrict to specific bench ID(s)
if not success then    print('Failed to register recipe: ' .. err)end

📥 Parameters

NameTypeRequiredDescription
keystring✅Unique identifier for the recipe.
labelstring✅Display name shown in the UI.
categorystring✅Category for bench matching.
outputtable✅What the player receives (item, count, optional metadata).
ingredientstable✅Required items to craft (item name = count).
timenumber✅Crafting time in milliseconds.
levelRequirednumber❌Minimum skill level required (default: 0).
xpRewardnumber❌XP gained on successful craft.
emotestring❌Emote override for this recipe.
benchIdstable❌Second parameter - restrict recipe to specific bench ID(s).

📤 Returns

NameTypeDescription
successbooleanWhether the recipe was registered successfully.
errstringError message if registration failed.

UnregisterBench

Manually unregister a bench (usually not needed - auto-cleanup handles this).

Lua
exports['possible-crafting']:UnregisterBench('ballas_drug_lab')

📥 Parameters

NameTypeRequiredDescription
benchIdstring✅The unique identifier of the bench to unregister.

UnregisterRecipe

Manually unregister a recipe.

Lua
exports['possible-crafting']:UnregisterRecipe('meth_bag')

📥 Parameters

NameTypeRequiredDescription
recipeKeystring✅The unique identifier of the recipe to unregister.

GetDynamicBenches

Get all currently registered dynamic benches.

Lua
local benches = exports['possible-crafting']:GetDynamicBenches()for benchId, benchData in pairs(benches) do    print('Bench: ' .. benchId .. ' - ' .. benchData.label)end

📤 Returns

NameTypeDescription
benchestableA table of all dynamic benches, keyed by their bench ID.
JDB-NET Logo
Partner Service

Self-hosted unlimited logs with managed Grafana

JDB-NET provides a self-hosted solution with unlimited logs, a fully managed Grafana instance, and unlimited users. Perfect for FiveM servers that need comprehensive logging and monitoring.

Check out JDB-NET