A FiveM crafting system with placeable benches, weapon repair, and ox_inventory integration.
- Download and place the
sjcraftingfolder in your server's resources directory - Add
ensure sjcraftingto your server.cfg - Ensure you have the following dependencies:
- Qbox
- Ox_lib
- Ox_inventory
- Ox_target
Navigate to the web directory and install dependencies:
cd web
npm install
npm run buildAdd these items to your ox_inventory items.lua:
['crafting_bench_w'] = {
label = 'Weapon Crafting Bench',
weight = 5000,
stack = false,
close = true,
description = 'Placeable weapon crafting bench',
consume = 0,
buttons = {
{
label = 'Place Crafting Bench',
action = function(slot)
exports.SJCrafting:placeCraftingBench(slot)
end
}
}
},
['police_crafting_bench'] = {
label = 'Police Equipment Bench',
weight = 5000,
stack = false,
close = true,
description = 'Placeable police equipment bench',
consume = 0,
buttons = {
{
label = 'Place Crafting Bench',
action = function(slot)
exports.SJCrafting:placeCraftingBench(slot)
end
}
}
}The script will automatically create the required database tables on startup. If you encounter any database issues, you can manually run the database.sql file in your MySQL database.
To add additional placeable crafting benches:
- Add the item to ox_inventory items.lua with the placement button:
['your_crafting_bench'] = {
label = 'Your Crafting Bench',
weight = 5000,
stack = false,
close = true,
description = 'Placeable crafting bench',
consume = 0,
buttons = {
{
label = 'Place Crafting Bench',
action = function(slot)
exports.SJCrafting:placeCraftingBench(slot)
end
}
}
}- Add the bench type to
Config.CraftingStations.placeableinmodules/config.lua:
your_bench_type = {
label = "Your Crafting Bench",
description = "Description of your bench",
item = "your_crafting_bench",
prop = "prop_tool_bench02",
type = "your_type",
weaponRepair = false,
allowedJobs = {
{job = "your_job", grade = 0}
}
}- Add crafting recipes to
Config.CraftingItems.your_typesection
Add recipes to the appropriate section and type in Config.CraftingItems:
{
name = "item_name",
label = "Item Label",
description = "Item description",
time = 30, -- seconds
requiredLevel = 1,
maxAmount = 10,
successChance = 100, -- percentage
xpReward = 10,
recipe = {
{item = "material1", amount = 2},
{item = "material2", amount = 1}
}
}- Placeable crafting benches
- Weapon repair system
- Job-based access control
- Level and XP system
- Queue-based crafting
- ox_inventory integration
- ox_target interaction
- /createcrafting to create a new crafting table
- /managecrafting to view, teleport to, and delete all crafting tables
- Use a crafting bench item from inventory(or place as admin)
- Approach the placed bench and third eye to interact
- Select items to craft or repair
- Wait for crafting/repair to complete
placeCraftingBench(slot)- Places a crafting bench from inventory slot