server side
Registers a new crafting location with recipes and configuration.
Parameters:
data
(table): Crafting configuration object containing:loc
(table): Array of location objects with coordinates and checksrecipes
(table): Recipe definitions with items, amounts, and requirementschecks
(table, optional): Access restrictions (job, gang, items, citizenid)targetData
(table, optional): Target system configuration
Returns:
None
Export:
exports['ps-lib']:registerCrafter(data)
Configuration Structure
Basic Crafting Location
local craftingData = {
loc = {
{
loc = vector3(-819.71, -859.37, 20.71),
checks = {} -- Location-specific restrictions
}
},
recipes = {
lockpick = {
amount = 1,
time = 5000,
anim = 'uncuff',
recipe = {
steel = 2,
iron = 1
}
}
},
checks = { -- Global restrictions for this crafter
job = {'police', 'mechanic'},
},
targetData = {
size = {
height = 1.0,
width = 1.0,
length = 1.0,
rotation = 180.0
},
label = 'Open Crafting',
icon = 'fa-solid fa-hammer'
}
}
exports['ps-lib']:registerCrafter(craftingData)
Recipe Configuration
Recipe Properties
KEY VALUE (item name)
amount
(number, optional): Number of items to give. Default: 1time
(number, optional): Crafting time in milliseconds. Default: 5000anim
(string, optional): Animation/emote to play. Default: 'uncuff'recipe
(table, optional): Required items and amounts. Default: {} (free craft)minigame
(table, optional): Minigame configuration
Example\
lockpick = {
amount = 1,
recipe = { -- or recipe = {} for free craft
steel = 1,
iron = 2,
},
anim = 'uncuff',
time = 3000,
minigame = {
type = 'ps-circle', -- Minigame type
data = {
circles = 4,
time = 8
}
},
Minigame Integration
minigame = {
type = 'ps-circle', -- Minigame type
data = {
circles = 4,
time = 8
}
}
Job Restrictions
checks = {
job = {'police', 'ambulance', 'mechanic'}
}
or
checks = {
job = 'police'
}
Gang Restrictions
checks = {
gang = 'ballas'
}
or
checks = {
gang = {'ballas', 'vagos', 'families'}
}
Item Requirements
checks = {
items = {'crafting_license', 'workshop_key'}
}
or
checks = {
items = 'crafting_license'
}
Citizen ID Restrictions
checks = {
citizenid = 'ABC12345'
}
or
checks = {
citizenid = {'ABC12345', 'DEF67890'}
}
Multiple Restrictions
checks = {
job = {'mechanic'},
items = {'advanced_tools'},
gang = {'mechanics_union'}
}
Usage Examples
Basic Workshop
local workshopCrafting = {
loc = {
{
loc = vector3(123.45, 456.78, 30.12),
checks = {}
}
},
recipes = {
lockpick = {
amount = 1,
time = 5000,
anim = 'uncuff',
recipe = {
steel = 2,
plastic = 1
}
},
screwdriver = {
amount = 1,
time = 3000,
anim = 'mechanic',
recipe = {
steel = 1,
rubber = 1
}
}
},
targetData = {
label = 'Use Workshop',
icon = 'fa-solid fa-tools'
}
}
exports['ps-lib']:registerCrafter(workshopCrafting)
Last updated