NextGenFiveM DocsNextGenFiveM Docs

NextGen FiveM
Documentation

crafting

Guides

How It WorksInstallationEditor
CommandsFaq

Developer

Custom FrameworkCustom InventoryExportsHooksScript Explorer

Exports

List of available exports for the resource.

Previous

Custom Inventory

Next

Hooks

On this page

Server Exports
getPlayerBlueprints
givePlayerBlueprint
removePlayerBlueprint
getPlayerLevel
setPlayerLevel
setPlayerCategoryLevel
givePortableItem
setEntityAsBench
removeEntityAsBench
setCoordAsBench
getBenchModels
Bench Locations
getBenchLocations
getBenchLocation
createBenchLocation
updateBenchLocation
deleteBenchLocation
Bench Types
getBenchTypes
getBenchType
getBenchTypeLocations
getAccessIdentifiers
createBenchType
updateBenchType
deleteBenchType
Blueprints
getTotalBlueprints
fetchBlueprints
getBlueprint
createBlueprint
updateBlueprint
deleteBlueprint
Categories
getCategories
getCategoryRecipes
createCategory
updateCategory
deleteCategory
Recipes
fetchRecipeIngredients
fetchRecipeBlueprints
getRecipe
createRecipe
updateRecipe
deleteRecipe
updateRecipeOrder
Items
fetchItems
getItem

Server Exports

getPlayerBlueprints

Retrieves a table containing the player's blueprints.

-- Example Usage:
local blueprints = exports['nextgenfivem_crafting']:getPlayerBlueprints(src)
PropTypeDefault
src
number
-

givePlayerBlueprint

Grants a blueprint to a player. Returns a boolean indicating success.

-- Example Usage:
local success = exports['nextgenfivem_crafting']:givePlayerBlueprint(src, 'pistol')
PropTypeDefault
src
number
-
blueprint
string
-

removePlayerBlueprint

Removes a blueprint from a player. Returns a boolean indicating success.

-- Example Usage:
local success = exports['nextgenfivem_crafting']:removePlayerBlueprint(src, 'pistol')
PropTypeDefault
src
number
-
blueprint
string
-

getPlayerLevel

Retrieves the player's current crafting level.

-- Example Usage:
local level = exports['nextgenfivem_crafting']:getPlayerLevel(src)
PropTypeDefault
src
number
-

setPlayerLevel

Sets the player's global crafting level. Returns a boolean indicating success.

-- Example Usage:
local success = exports['nextgenfivem_crafting']:setPlayerLevel(src, 10)
PropTypeDefault
src
number
-
level
number
-

setPlayerCategoryLevel

Sets the player's level for a specific crafting category. Returns a boolean indicating success.

-- Example Usage:
local success = exports['nextgenfivem_crafting']:setPlayerCategoryLevel(src, 'weapons', 5)
PropTypeDefault
src
number
-
category
string
-
level
number
-

givePortableItem

Gives a player a portable crafting bench item. Returns a boolean indicating success.

-- Example Usage:
local success = exports['nextgenfivem_crafting']:givePortableItem(src, 'police')
PropTypeDefault
src
number
-
benchType
string
-

setEntityAsBench

Assigns an entity as a crafting bench. Returns a result table.

-- Returns:
result = {
    success: boolean, -- Indicates if the entity was successfully assigned as a bench
    message: string   -- The result message
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:setEntityAsBench(entity, 'police')
PropTypeDefault
entity
number
-
benchType
string
-

removeEntityAsBench

Removes an entity from being a crafting bench. Returns a result table.

-- Returns:
result = {
    success: boolean, -- Indicates if the entity was successfully removed as a bench
    message: string   -- The result message
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:removeEntityAsBench(entity)
PropTypeDefault
entity
number
-

setCoordAsBench

Assigns a coordinate as a crafting bench. Returns a result table with a remove function.

-- Returns:
result = {
    success: boolean,
    id: string,        -- The bench ID
    remove: function   -- Function to remove the bench
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:setCoordAsBench(
    vector4(0.0, 0.0, 0.0, 0.0),
    'police',
    1 -- Optional routing bucket
)
PropTypeDefault
coord
vector4
-
benchType
string
-
routingBucket
number
-

getBenchModels

Retrieves a table containing the models for all crafting benches.

-- Returns:
[key: string] = {
    title: string,
    model: string,
    centerOffset: vector4,
    scale: number
}
 
-- Example Usage:
local models = exports['nextgenfivem_crafting']:getBenchModels()

Bench Locations

getBenchLocations

Retrieves a paginated list of bench locations.

-- Returns:
result = {
    success: boolean,
    rows: table,       -- Array of bench location objects
    pageCount: number  -- Total number of pages
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:getBenchLocations({
    columnFilters = {}, -- Optional: Table of column filters
    orderColumn = 'created_at', -- Required: Column to order by
    orderDirection = 'ASC', -- Required: Order direction (ASC or DESC)
    count = 10, -- Required: Number of items per page
    offset = 0 -- Required: Offset for pagination
})
PropTypeDefault
data
table
-

getBenchLocation

Retrieves a single bench location by ID.

-- Returns:
result = {
    success: boolean,
    benchLocation: table -- The bench location object
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:getBenchLocation('bench-uuid')
PropTypeDefault
id
string
-

createBenchLocation

Creates a new bench location.

-- Returns:
result = {
    success: boolean,
    uuid: string -- The UUID of the created bench location
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:createBenchLocation({
    benchType = 'bench-type-uuid',
    location = { x = 0.0, y = 0.0, z = 0.0, w = 0.0 },
    isPortable = false,
    createdBy = 'identifier'
})
PropTypeDefault
data
table
-

updateBenchLocation

Updates an existing bench location.

-- Returns:
result = {
    success: boolean
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:updateBenchLocation({
    uuid = 'bench-uuid',
    benchType = 'bench-type-uuid',
    location = { x = 0.0, y = 0.0, z = 0.0, w = 0.0 },
    isPortable = false
})
PropTypeDefault
data
table
-

deleteBenchLocation

Deletes a bench location by ID.

-- Returns:
result = {
    success: boolean
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:deleteBenchLocation('bench-uuid')
PropTypeDefault
id
string
-

Bench Types

getBenchTypes

Retrieves a paginated list of bench types.

-- Returns:
result = {
    success: boolean,
    rows: table,       -- Array of bench type objects
    pageCount: number  -- Total number of pages
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:getBenchTypes({
    columnFilters = {},
    orderColumn = 'name',
    orderDirection = 'ASC',
    count = 10,
    offset = 0
})
PropTypeDefault
data
table
-

getBenchType

Retrieves a single bench type by ID.

-- Returns:
result = {
    success: boolean,
    benchType: table -- The bench type object
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:getBenchType('bench-type-uuid')
PropTypeDefault
id
string
-

getBenchTypeLocations

Retrieves all locations for a specific bench type.

-- Returns:
result = {
    success: boolean,
    locations: table -- Array of bench location objects
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:getBenchTypeLocations('bench-type-uuid')
PropTypeDefault
id
string
-

getAccessIdentifiers

Retrieves available access identifiers from the framework.

-- Returns:
result = {
    success: boolean,
    identifiers: table -- Array of access identifiers
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:getAccessIdentifiers()

createBenchType

Creates a new bench type.

-- Returns:
result = {
    success: boolean,
    uuid: string -- The UUID of the created bench type
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:createBenchType({
    name = 'police',
    model = 'default',
    fullAccess = false,
    createdBy = 'identifier',
    access = {
        {
            identifier = 'police',
            selectedRanks = { 'officer', 'sergeant' }
        }
    },
    categories = {
        {
            categoryId = 'category-uuid',
            isDefaultDenied = false,
            recipes = { 'recipe-uuid-1', 'recipe-uuid-2' }
        }
    }
})
PropTypeDefault
data
table
-

updateBenchType

Updates an existing bench type.

-- Returns:
result = {
    success: boolean
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:updateBenchType({
    uuid = 'bench-type-uuid',
    name = 'police',
    model = 'default',
    fullAccess = false,
    access = {
        {
            identifier = 'police',
            selectedRanks = { 'officer', 'sergeant' }
        }
    },
    categories = {
        {
            categoryId = 'category-uuid',
            isDefaultDenied = false,
            recipes = { 'recipe-uuid-1', 'recipe-uuid-2' }
        }
    }
})
PropTypeDefault
data
table
-

deleteBenchType

Deletes a bench type by ID.

-- Returns:
result = {
    success: boolean
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:deleteBenchType('bench-type-uuid')
PropTypeDefault
id
string
-

Blueprints

getTotalBlueprints

Retrieves the total count of blueprints, optionally filtered by search term.

-- Returns:
number -- Total count of blueprints
 
-- Example Usage:
local total = exports['nextgenfivem_crafting']:getTotalBlueprints('pistol')
PropTypeDefault
search
string
-

fetchBlueprints

Retrieves a paginated list of blueprints.

-- Returns:
result = {
    success: boolean,
    blueprints: table,  -- Array of blueprint objects
    nextPage: number,   -- Next page number or nil
    pageCount: number   -- Total number of pages
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:fetchBlueprints({
    page = 1,
    search = 'pistol'
})
PropTypeDefault
data
table
-

getBlueprint

Retrieves a single blueprint by ID.

-- Returns:
result = {
    success: boolean,
    blueprint: table -- The blueprint object
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:getBlueprint('blueprint-uuid')
PropTypeDefault
id
string
-

createBlueprint

Creates a new blueprint.

-- Returns:
result = {
    success: boolean
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:createBlueprint({
    label = 'Pistol Blueprint',
    description = 'A blueprint for crafting pistols',
    uses = 1
})
PropTypeDefault
data
table
-

updateBlueprint

Updates an existing blueprint.

-- Returns:
result = {
    success: boolean
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:updateBlueprint({
    uuid = 'blueprint-uuid',
    label = 'Pistol Blueprint',
    description = 'A blueprint for crafting pistols',
    uses = 1
})
PropTypeDefault
data
table
-

deleteBlueprint

Deletes a blueprint by ID.

-- Returns:
result = {
    success: boolean
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:deleteBlueprint({
    uuid = 'blueprint-uuid'
})
PropTypeDefault
data
table
-

Categories

getCategories

Retrieves all crafting categories.

-- Returns:
result = {
    success: boolean,
    categories: table -- Array of category objects
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:getCategories()

getCategoryRecipes

Retrieves recipes for a specific category with pagination.

-- Returns:
result = {
    success: boolean,
    recipes: table,       -- Array of recipe objects
    hasMore: boolean,     -- Whether there are more recipes
    nextPage: number,     -- Next page number or nil
    totalRecipes: number, -- Total number of recipes
    currentPage: number   -- Current page number
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:getCategoryRecipes({
    category = 'weapons',
    page = 1,
    limit = 20
})
PropTypeDefault
data
table
-

createCategory

Creates a new crafting category.

-- Returns:
result = {
    success: boolean
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:createCategory({
    title = 'Weapons',
    description = 'Weapon crafting category',
    icon = 'fa-gun',
    image = 'weapons.png'
})
PropTypeDefault
data
table
-

updateCategory

Updates an existing category.

-- Returns:
result = {
    success: boolean
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:updateCategory({
    uuid = 'category-uuid',
    title = 'Weapons',
    description = 'Weapon crafting category',
    icon = 'fa-gun',
    image = 'weapons.png'
})
PropTypeDefault
data
table
-

deleteCategory

Deletes a category by ID.

-- Returns:
result = {
    success: boolean
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:deleteCategory({
    uuid = 'category-uuid'
})
PropTypeDefault
data
table
-

Recipes

fetchRecipeIngredients

Retrieves all ingredients for a specific recipe.

-- Returns:
result = {
    success: boolean,
    ingredients: table -- Array of ingredient objects
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:fetchRecipeIngredients('recipe-uuid')
PropTypeDefault
id
string
-

fetchRecipeBlueprints

Retrieves all blueprints required for a specific recipe.

-- Returns:
result = {
    success: boolean,
    blueprints: table -- Array of blueprint objects
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:fetchRecipeBlueprints('recipe-uuid')
PropTypeDefault
id
string
-

getRecipe

Retrieves a single recipe by ID.

-- Returns:
result = {
    success: boolean,
    recipe: table -- The recipe object
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:getRecipe('recipe-uuid')
PropTypeDefault
id
string
-

createRecipe

Creates a new recipe.

-- Returns:
result = {
    success: boolean
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:createRecipe({
    title = 'Pistol',
    description = 'A standard pistol',
    category = 'category-uuid',
    requiredLevel = 5,
    requiredCategoryLevel = 3,
    craftingTime = 10,
    xpReward = 25,
    propModel = 'prop_pistol',
    propRot = { x = 0.0, y = 0.0, z = 0.0 },
    propOffset = { x = 0.0, y = 0.0, z = 0.0 },
    cooldownLimit = 5,
    cooldownWindow = 60,
    ingredients = {
        { item = 'iron', count = 5 },
        { item = 'steel', count = 2 }
    },
    results = {
        { item = 'pistol', count = 1, metadata = {} }
    },
    blueprints = {
        { blueprintId = 'blueprint-uuid' }
    }
})
PropTypeDefault
data
table
-

updateRecipe

Updates an existing recipe.

-- Returns:
result = {
    success: boolean
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:updateRecipe({
    uuid = 'recipe-uuid',
    title = 'Pistol',
    description = 'A standard pistol',
    requiredLevel = 5,
    requiredCategoryLevel = 3,
    craftingTime = 10,
    xpReward = 25,
    propModel = 'prop_pistol',
    propRot = { x = 0.0, y = 0.0, z = 0.0 },
    propOffset = { x = 0.0, y = 0.0, z = 0.0 },
    cooldownLimit = 5,
    cooldownWindow = 60,
    ingredients = {
        { item = 'iron', count = 5 },
        { item = 'steel', count = 2 }
    },
    results = {
        { item = 'pistol', count = 1, metadata = {} }
    },
    blueprints = {
        { blueprintId = 'blueprint-uuid' }
    }
})
PropTypeDefault
data
table
-

deleteRecipe

Deletes a recipe by ID.

-- Returns:
result = {
    success: boolean
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:deleteRecipe({
    uuid = 'recipe-uuid'
})
PropTypeDefault
data
table
-

updateRecipeOrder

Updates the order of a recipe within a category or moves it to a different category.

-- Returns:
result = {
    success: boolean,
    message: string -- Optional error message
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:updateRecipeOrder({
    recipe = 'recipe-uuid',
    fromCategory = 'category-uuid',
    toCategory = 'category-uuid',
    newIndex = 1
})
PropTypeDefault
data
table
-

Items

fetchItems

Retrieves a paginated list of items from the inventory system.

-- Returns:
result = {
    success: boolean,
    items: table,      -- Array of item objects
    nextPage: number,  -- Next page number or nil
    pageCount: number  -- Total number of pages
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:fetchItems({
    page = 1,
    search = 'pistol'
})
PropTypeDefault
data
table
-

getItem

Retrieves a single item by name.

-- Returns:
result = {
    success: boolean,
    item: table -- The item object
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:getItem('pistol')
PropTypeDefault
name
string
-