FAQ

How do you add a blueprint?

To add a "blueprint" to a shop you need to create a new line with the item and the info it will spawn with

For Example:

{ name = "craftrecipe", price = 0, amount = 10000, info = { item = QBCore.Shared.Items["weapon_bat"].label, oneUse = true, CraftAdd = 1 }, },

item is the name (from the items.lua) of the item this blueprint will craft

oneUse is self-explanatory, if this is true, then the blueprint is removed when crafting is complete

CraftAdd is the number of the recipe, which is set in customRecipes = {} in the config.lua

Make sure that the item and CraftAdd match. As it will cause a lot of headaches if they do not when they are given to players. The only way to fix it after the item is created is:

  • Remove it and have them get a new one

  • Edit player item info in the database to show the correct info

How can I put a blueprint in a different script?

This can also be used for giving items elsewhere such as dumpster diving, robbing peds, fishing, etc. You just need an extra few lines of code that will grant a new craftrecipe with the item info

Player.Functions.AddItem("craftrecipe", 1, nil, { item = QBCore.Shared.Items["weapon_bat"].label, oneUse = true, CraftAdd = 1 })

For more advanced selection: In your script, when you want the blueprint to be given create a table of the info you want to be used when creating the blueprint

  local list = {
    { item = QBCore.Shared.Items["weapon_bat"].label, oneUse = true, CraftAdd = 1 },
    { item = QBCore.Shared.Items["weapon_knife"].label, oneUse = true, CraftAdd = 2 },
  }
  Player.Functions.AddItem("craftrecipe", 1, nil, list[math.random(1, #list)])

This will randomly choose a recipe to be added to the blueprint

Last updated