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.
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
| Name | Type | Required | Description |
|---|---|---|---|
id | string | ✅ | Unique identifier for the bench. |
label | string | ✅ | Display name shown in the UI. |
coords | vec3 or table | ✅ | Location coordinates. Can be a single vec3 or table of vec3 for multiple locations. |
radius | number | ❌ | Interaction radius (use this OR length/width/heading for box zones). |
length | number | ❌ | Box zone length (alternative to radius). |
width | number | ❌ | Box zone width (requires length). |
heading | number | ❌ | Box zone rotation (requires length/width). |
gang | string or table | ❌ | Restrict access to specific gang(s). |
job | string or table | ❌ | Restrict access to specific job(s). |
useCategories | boolean | ❌ | Enable category-based recipe filtering. |
categories | table | ❌ | Category definitions with labels and optional skill requirements. |
emote | string | ❌ | Emote to play while crafting. |
blip | table | ❌ | Map blip settings (enable, sprite, colour, scale, label). |
debug | boolean | ❌ | Show debug zone visualization. |
📤 Returns
| Name | Type | Description |
|---|---|---|
success | boolean | Whether the bench was registered successfully. |
err | string | Error message if registration failed. |
RegisterRecipe
This export is used to register a new crafting recipe from your external resource.
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
| Name | Type | Required | Description |
|---|---|---|---|
key | string | ✅ | Unique identifier for the recipe. |
label | string | ✅ | Display name shown in the UI. |
category | string | ✅ | Category for bench matching. |
output | table | ✅ | What the player receives (item, count, optional metadata). |
ingredients | table | ✅ | Required items to craft (item name = count). |
time | number | ✅ | Crafting time in milliseconds. |
levelRequired | number | ❌ | Minimum skill level required (default: 0). |
xpReward | number | ❌ | XP gained on successful craft. |
emote | string | ❌ | Emote override for this recipe. |
benchIds | table | ❌ | Second parameter - restrict recipe to specific bench ID(s). |
📤 Returns
| Name | Type | Description |
|---|---|---|
success | boolean | Whether the recipe was registered successfully. |
err | string | Error message if registration failed. |
UnregisterBench
Manually unregister a bench (usually not needed - auto-cleanup handles this).
exports['possible-crafting']:UnregisterBench('ballas_drug_lab')📥 Parameters
| Name | Type | Required | Description |
|---|---|---|---|
benchId | string | ✅ | The unique identifier of the bench to unregister. |
UnregisterRecipe
Manually unregister a recipe.
exports['possible-crafting']:UnregisterRecipe('meth_bag')📥 Parameters
| Name | Type | Required | Description |
|---|---|---|---|
recipeKey | string | ✅ | The unique identifier of the recipe to unregister. |
GetDynamicBenches
Get all currently registered dynamic benches.
local benches = exports['possible-crafting']:GetDynamicBenches()for benchId, benchData in pairs(benches) do print('Bench: ' .. benchId .. ' - ' .. benchData.label)end📤 Returns
| Name | Type | Description |
|---|---|---|
benches | table | A table of all dynamic benches, keyed by their bench ID. |
