⚙️・Adjustments
⚙️・Crafting Tables

⚙️・Crafting Tables

So let's start setting up the crafting tables.

Config.CraftingTables

The individual processing tables can now be configured here:

['simple_crafting_table'] = {
        zone = vector3(2.0, 1.0, 2.0),
        label = 'Weed Processing Table', -- Label for the table
        model = 'v_res_tre_table2', -- Exanples: freeze_it-scripts_empty_table, freeze_it-scripts_weed_table, freeze_it-scripts_coke_table, freeze_it-scripts_meth_table
        restricCrafting = {
            ['onlyOnePlayer'] = true, -- Only one player can use the table at a time
            ['onlyOwnerCraft'] = false, -- Only the owner of the table can use it
            ['onlyOwnerRemove'] = true, -- Only the owner of the table can remove it
            ['zones'] = {}, -- Zones where the table can be used
            ['jobs'] = {}
        },
        blip = {
            display = true, -- Display blip on map
            sprite = 446, -- Select blip from (https://docs.fivem.net/docs/game-references/blips/)
            displayColor = 2, -- Select blip color from (https://docs.fivem.net/docs/game-references/blips/)
            displayText = 'Crafting Table',
        },
        recipes = {
            -- Here you can add as many recipes as you want
        }
    }
['simple_crafting_table']

This is the name of the item to which this configuration is bound. The item can now be used to set up a table in the game.


target = {
    size = vector3(3.5, 1.0, 1.0),
    rotation = 0.0,
    drawSprite = true,
    interactDistance = 1.5,
},

As soon as the player places the table, the script will create a zone around the table. The zone is used to interact with the table. Here you can change some settings for the target zone.

  • size * - The size of the target zone. The first value is the width, the second value is the length, and the third value is the height of the zone.
  • rotation * - The rotation of the target zone. The value is in degrees. If you dont want to use this you can remove it.
  • drawSprite * - If set to true, a sprite will be displayed at the target zone. If set to false, no sprite will be displayed.
  • interactDistance * - The distance at which the player can interact with the table.

* All these values are optional and can be removed if you dont want to use them. But please do not remove the target table.


model = 'v_res_tre_table2'

The model of the processing table here can theoretically be used with any Fivem model.


restricCrafting = {
    ['onlyOnePlayer'] = true, -- Only one player can use the table at a time
    ['onlyOwnerCraft'] = false, -- Only the owner of the table can use it
    ['onlyOwnerRemove'] = true, -- Only the owner of the table can remove it
    ['zones'] = {}, -- Zones where the table can be used
    ['jobs'] = {}
},
  • onlyOnePlayer - As the name suggests, only one player can use the table at a time.
  • onlyOwnerCraft - Only the owner of the table can use the table.
  • onlyOwnerRemove - Only the owner of the table can remove the table.
  • zones - Zones where the table can be used.
    • The zones can be defined in the Config.Zones table.
    • If you want to use the table everywhere, you can leave the table empty.
    • If you want to add a zone, you can add the zone name to the table like this: {'crafting_zone_one'}. Now the table can only be used in this zone.
  • jobs - Jobs that can use the table.
    • If you want to allow all jobs to use the table, you can leave the table empty.
    • If you want to add a job, you can add the job name to the table like this: ['police'] = true. Now only the police can use the table. You also hove the option to add a job with a specific grade like this: ['police'] = {1, 2}. Now only the police with the grade 1 and 2 can use the table.

blip = {
    display = true, -- Display blip on map
    scale = 1.0, -- Blip scale
    sprite = 446, -- Select blip from (https://docs.fivem.net/docs/game-references/blips/)
    displayColor = 2, -- Select blip color from (https://docs.fivem.net/docs/game-references/blips/)
    displayText = 'Crafting Table',
},

The blip fie zone can be set here. If set to true, the blip will be displayed on the map as soon as the table is placed.

Recipes

Each table can theoretically have an infinite number of recipes, how exactly a recipe must look is explained here

Loading...

If you use the ox_inventory, please use the following template to add the tables to your items.lua:

["item_name"] = {
		label = "Item Label",
		weight = 1000,
		stack = false,
		close = true,
		description = "Item Description",
		server = {
			export = "it-drugs.placeProcessingTable"
		},
		client = {
			image = "item_name.png",
		}
	},

Each item_name must be replaced with the actual item name

    ['simple_crafting_table'] = {
        target = {
            size = vector3(1.0, 1.0, 1.0),
            rotation = 0.0,
            drawSprite = true,
            interactDistance = 1.5,
        },
        label = 'Weed Processing Table', -- Label for the table
        model = 'v_res_tre_table2', -- Exanples: freeze_it-scripts_empty_table, freeze_it-scripts_weed_table, freeze_it-scripts_coke_table, freeze_it-scripts_meth_table
        restricCrafting = {
            ['onlyOnePlayer'] = true, -- Only one player can use the table at a time
            ['onlyOwnerCraft'] = false, -- Only the owner of the table can use it
            ['onlyOwnerRemove'] = true, -- Only the owner of the table can remove it
            ['zones'] = {}, -- Zones where the table can be used
            ['jobs'] = {}
        },
        blip = {
            display = true, -- Display blip on map
            sprite = 446, -- Select blip from (https://docs.fivem.net/docs/game-references/blips/)
            displayColor = 2, -- Select blip color from (https://docs.fivem.net/docs/game-references/blips/)
            displayText = 'Crafting Table',
        },
        recipes = {
            -- Here you can add as many recipes as you want
        }
    }