Configuration

Portable Benches

Learn how to set up portable benches.

Setting Up Portable Benches

  1. Open config.lua in the resource folder.

  2. Find the BenchOptions section:

    BenchOptions = {
        enablePortableBenches = false,
        ...
    }
  3. Change enablePortableBenches to true.

  4. Save the file and restart the resource.

  5. Navigate to your inventory resource (or item configuration), and add the following item:

    ['crafting_bench'] = {
        name = 'crafting_bench',
        label = 'Crafting Bench',
        weight = 100,
        type = 'item',
        image = 'crafting_bench.png',
        unique = true,
        useable = true,
        shouldClose = true,
        combinable = nil,
        description = 'Place a crafting bench.'
    },

    (Example for QBCore. Configuration may vary depending on your inventory resource. The item name must be crafting_bench and must be unstackable.)

  6. Save the file and restart the resource.

Players can now place benches using the crafting_bench item.


Dynamic Portable Bench Items

To create a more dynamic item system, items can be linked to specific bench types. This allows items to have unique variations based on their bench type association.

For example, Police bench type should be stored as:

['police_crafting_bench'] = {
    name = 'police_crafting_bench',
    label = 'Police Crafting Bench',
    weight = 50,
    type = 'item',
    image = 'crafting_bench.png',
    unique = true,
    useable = true,
    shouldClose = true,
    combinable = nil,
    description = 'A police crafting bench.'
}

This system ensures that bench types can define item properties dynamically.

How the Search Function Works

In our script, everything before _crafting_bench acts as a search key. This means when searching for an item, the script will recognize police as the base item and match it to the police_crafting_bench. This allows easy categorization and retrieval of bench type linked items.


Giving the Item

To give the item to a player:

  • Open the editor and click the "Give item" button on the desired bench type.
  • Use one of the resource's commands.
  • Use one of the resource's exports.

Item Image

You can use the following image for the item in your inventory:

Crafting Bench Image

Developer Note

The item must include metadata like this:

metadata = {
    benchType = 'UUID', -- The UUID of the bench type
}

Replace UUID with the desired bench type UUID, which can be found in the editor.

On this page