Exports

List of available exports for the resource.

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 boolean indicating success.

-- 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 boolean indicating success.

-- 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 boolean indicating success.

-- 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
string
-

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', -- Required: Bench type UUID
    location = { -- Required: Location object
        x = 0.0,
        y = 0.0,
        z = 0.0,
        w = 0.0
    },
    isPortable = false, -- Optional: Whether the bench is portable (default: false)
    createdBy = 'identifier' -- Optional: Creator 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', -- Required: Bench location UUID
    benchType = 'bench-type-uuid', -- Required: Bench type UUID
    location = { -- Required: Location object
        x = 0.0,
        y = 0.0,
        z = 0.0,
        w = 0.0
    },
    isPortable = false -- Required: Whether the bench is portable
})
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 = {}, -- Optional: Table of column filters
    orderColumn = 'name', -- 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
-

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', -- Required: Bench type name
    model = 'default', -- Required: Model name
    fullAccess = false, -- Required: Whether the bench has full access to all categories
    createdBy = 'identifier', -- Optional: Creator identifier
    access = { -- Optional: Array of access rules (only if fullAccess is false)
        {
            identifier = 'police',
            selectedRanks = { 'officer', 'sergeant' } -- Optional: Array of rank strings
        }
    },
    categories = { -- Optional: Array of categories (only if fullAccess is false)
        {
            categoryId = 'category-uuid',
            isDefaultDenied = false, -- Whether to deny all recipes by default
            recipes = { 'recipe-uuid-1', 'recipe-uuid-2' } -- Array of recipe UUIDs
        }
    }
})
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', -- Required: Bench type UUID
    name = 'police', -- Required: Bench type name
    model = 'default', -- Required: Model name
    fullAccess = false, -- Required: Whether the bench has full access
    access = { -- Optional: Array of access rules (only if fullAccess is false)
        {
            identifier = 'police',
            selectedRanks = { 'officer', 'sergeant' } -- Optional: Array of rank strings
        }
    },
    categories = { -- Optional: Array of categories (only if fullAccess is false)
        {
            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, -- Optional: page number
    search = 'pistol' -- Optional: search term
})
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', -- Required: Blueprint label
    description = 'A blueprint for crafting pistols', -- Optional: Blueprint description
    uses = 1 -- Optional: Number of uses (null for unlimited)
})
PropTypeDefault
data
table
-

updateBlueprint

Updates an existing blueprint.

-- Returns:
result = {
    success: boolean
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:updateBlueprint({
    uuid = 'blueprint-uuid', -- Required: Blueprint UUID
    label = 'Pistol Blueprint', -- Required: Blueprint label
    description = 'A blueprint for crafting pistols', -- Optional: Blueprint description
    uses = 1 -- Optional: Number of uses (null for unlimited)
})
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, -- Optional: page number (default: 1)
    limit = 20 -- Optional: items per page (default: 20, max: 100)
})
PropTypeDefault
data
table
-

createCategory

Creates a new crafting category.

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

updateCategory

Updates an existing category.

-- Returns:
result = {
    success: boolean
}
 
-- Example Usage:
local result = exports['nextgenfivem_crafting']:updateCategory({
    uuid = 'category-uuid', -- Required: Category UUID
    title = 'Weapons', -- Required: Category title
    description = 'Weapon crafting category', -- Required: Category description
    icon = 'fa-gun', -- Optional: Icon name
    image = 'weapons.png' -- Optional: Image path
})
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', -- Required: Recipe title
    description = 'A standard pistol', -- Required: Recipe description
    category = 'category-uuid', -- Required: Category UUID
    requiredLevel = 5, -- Optional: Required global level
    requiredCategoryLevel = 3, -- Optional: Required category level
    craftingTime = 10, -- Required: Crafting time in seconds
    xpReward = 25, -- Optional: XP reward (default: 25)
    propModel = 'prop_pistol', -- Optional: Prop model name
    propRot = { x = 0.0, y = 0.0, z = 0.0 }, -- Optional: Prop rotation
    propOffset = { x = 0.0, y = 0.0, z = 0.0 }, -- Optional: Prop offset
    cooldownLimit = 5, -- Optional: Cooldown limit
    cooldownWindow = 60, -- Optional: Cooldown window in seconds
    ingredients = { -- Optional: Array of ingredients
        { item = 'iron', count = 5 },
        { item = 'steel', count = 2 }
    },
    results = { -- Optional: Array of results
        { item = 'pistol', count = 1, metadata = {} }
    },
    blueprints = { -- Optional: Array of required 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', -- Required: Recipe UUID
    title = 'Pistol', -- Required: Recipe title
    description = 'A standard pistol', -- Required: Recipe description
    requiredLevel = 5, -- Optional: Required global level
    requiredCategoryLevel = 3, -- Optional: Required category level
    craftingTime = 10, -- Required: Crafting time in seconds
    xpReward = 25, -- Optional: XP reward
    propModel = 'prop_pistol', -- Optional: Prop model name
    propRot = { x = 0.0, y = 0.0, z = 0.0 }, -- Optional: Prop rotation
    propOffset = { x = 0.0, y = 0.0, z = 0.0 }, -- Optional: Prop offset
    cooldownLimit = 5, -- Optional: Cooldown limit
    cooldownWindow = 60, -- Optional: Cooldown window in seconds
    ingredients = { -- Optional: Array of ingredients (replaces all existing)
        { item = 'iron', count = 5 },
        { item = 'steel', count = 2 }
    },
    results = { -- Optional: Array of results (replaces all existing)
        { item = 'pistol', count = 1, metadata = {} }
    },
    blueprints = { -- Optional: Array of required blueprints (replaces all existing)
        { 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', -- Required: Recipe UUID
    fromCategory = 'category-uuid', -- Required: Source category UUID
    toCategory = 'category-uuid', -- Required: Target category UUID
    newIndex = 1 -- Required: The new position index (1-based)
})
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, -- Optional: page number
    search = 'pistol' -- Optional: search term
})
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
-