๐ ๏ธCraft System
Overview
Hate Crafting is an advanced and versatile crafting system for FiveM servers with multiple access methods, crafting levels, and a visually appealing interface. The script supports both ESX and QBCore frameworks, providing a seamless experience for players to craft items in your server.
Features
Multiple access methods: markers, objects, target systems
Crafting levels with progression
3D item preview with rotation
Persistent crafting - continue crafting even when the UI is closed
Material requirements and quantity selection
Compatible with ESX and QBCore frameworks
Customizable UI and crafting locations
Support for multiple target systems (qtarget, qb-target, ox_target)
Skill-based progression with HateSkills integration
Configuration Options
Basic Configuration
Item Images and Player Level
-- Base path for item images
Config.ImagePath = 'nui://core_inventory/html/img/'
-- Player level settings
Config.DefaultPlayerLevel = 1
Config.UsingHateSkills = true -- Set to true if using HateSkills for crafting levels
The ImagePath
setting determines where the script will look for item images. Adjust this to match your inventory resource.
Player level can be determined by the HateSkills resource (if enabled) or use the default level specified.
Crafting Duration
-- Craft duration settings
Config.DefaultCraftDuration = 10 -- Default craft duration in seconds
The DefaultCraftDuration
is the time (in seconds) it takes to craft an item unless overridden by a specific item configuration.
Crafting Items Configuration
Config.CraftableItems = {
-- Level 1 items
{
level = 1,
items = {
{
name = "field_dressing",
description = "Basic medical item to stop bleeding",
craftDuration = 25, -- Craft duration in seconds (overrides default)
materials = {
{name = "loot_cloth", amount = 2},
{name = "drink_jack", amount = 1}
}
},
-- Additional items...
}
},
-- Additional level groups...
}
The CraftableItems
table is organized by level groups, with each level containing a list of items. Each item has:
name
: The item spawn name (must match your inventory system)description
: A brief description of the itemcraftDuration
(optional): Custom craft duration that overrides the defaultmaterials
: List of required materials to craft the item, each with a name and amount
Access Methods Configuration
-- Access Method Settings - Choose how players can access crafting
Config.AccessMethod = "object" -- Options: "target", "marker", "object", "all", "command"
The AccessMethod
determines how players can access the crafting menu:
target
: Using a target system (qtarget, qb-target, ox_target)marker
: Using map markers at specific locationsobject
: Interacting with specific objects in the worldall
: Enabling all access methods
Target System Configuration
-- Target System Settings
Config.EnableTargetSystem = true -- Set to true to enable prop targeting
Config.TargetSystem = "ox_target" -- Options: "qtarget", "qb-target", "ox_target"
Config.TargetProps = { -- Props that can be interacted with
"prop_tool_bench02",
"prop_toolchest_01",
"prop_tool_box_04"
}
When using the target access method, these settings determine:
Which target system to use (qtarget, qb-target, or ox_target)
Which props can be targeted for crafting interaction
Marker System Configuration
-- Marker Settings
Config.CraftingLocations = {
{
coords = vector3(-1146.7, -2002.4, 13.18),
label = "Harbor Crafting",
blip = {
enabled = true,
sprite = 566,
color = 2,
scale = 0.8,
label = "Crafting Bench"
}
},
{
coords = vector3(458.84, -979.07, 30.68),
label = "Police Crafting",
blip = {
enabled = true,
sprite = 566,
color = 3,
scale = 0.8,
label = "Police Armory"
},
jobs = {"police"} -- Restrict by job
}
}
Config.MarkerType = 2 -- Marker type to display
Config.MarkerColor = {r = 154, g = 136, b = 102} -- RGB color of the marker
Config.MarkerSize = {x = 0.3, y = 0.3, z = 0.3} -- Size of the marker
Config.DrawDistance = 5.0 -- Distance to start drawing markers
The marker configuration allows:
Creating multiple crafting locations with coordinates
Adding map blips for each location
Job restrictions for specific locations
Customizing marker appearance and draw distance
Object Detection Configuration
-- Object Detection Settings
Config.CraftingObjects = {
-- Object name and label for each crafting object
{model = "prop_tool_bench02", label = "Crafting Bench"},
{model = "v_ret_gc_chair02", label = "Crafting Chair"},
{model = "prop_tool_box_04", label = "Crafting Box"}
}
Config.InteractionDistance = 2.0 -- Distance for object interaction
When using the object access method, these settings determine:
Which object models can be used for crafting
The maximum interaction distance for these objects
Display and Interface Configuration
-- Draw Text Settings (shared between marker and object methods)
Config.DrawTextPosition = "center" -- Options: "left", "center", "right"
Config.DrawTextFont = 4
Config.DrawTextScale = 0.4
Config.DrawTextColor = {r = 255, g = 255, b = 255, a = 255}
-- Key controls
Config.InteractionKey = 38 -- Default: E
-- Whether to allow the /crafting command
Config.EnableCommand = false
Config.OpenKey = 'J'
These settings control:
Text display format and position
Interaction key (default E)
Optional command access to the crafting menu
Integration with Frameworks
The script automatically detects whether your server is using ESX or QBCore framework and adapts accordingly. It uses the appropriate functions for:
Checking inventory contents
Adding and removing items
Job restrictions
Notifications
Adding Custom Items
To add new craftable items:
Add the item to your inventory system
Add the item to the appropriate level group in
Config.CraftableItems
Ensure the item image is available at the configured
Config.ImagePath
Example:
{
name = "custom_item",
description = "My custom craftable item",
craftDuration = 30,
materials = {
{name = "material1", amount = 3},
{name = "material2", amount = 1},
}
}
Support
For support with this script, please contact the developer through the provided channels or seek assistance from the community forums.
Credits
Developed by Hate for FiveM servers.