[Release][ESX] Crafting System

Is there a way where you can pick the item you want to craft? instead of it auto making it?

I got the interface to work by pressing a keyboard key. I can also select items out of my inventory, but when I click craft item, nothing happens. I also canā€™t get rid of the crafting interface anymore. Also if I press Esc. Any ideas how I can solve this?

is there a way we can rename this so we could make multiple crafting locations?

1 Like

Can we have different menus? As in we have weed crafting in one menu and then weapons in another?

Amazing release!!! Cheers for sharing.

How can I translate it? Thank you.
EDIT: Nevermind, just found it in the HTML lol

ANY WAY to adapt or have you ask for a weapon as an example recipe item

pistol + 2clip = smg

do you mean like the following?

['WEAPON_SMG'] = {
    { item = "WEAPON_PISTOL", quantity = 1},
    { item = "clip", quantity = 2 },
},

if we wanted to make this craft certain things to make them compact
say 7 weed is 1 bag
how would we go around making it 1 bag = 7 weed

Is there a way to set that only mafia can craft certain objets and they must go to a place where they can be crafted??

Hi !
I would like to have more manufacturing points for a single job. each point is specific to make certain items. can I have several points in a single script ?, I tried to have more than one but it is always the last one that appeared.

Awesome!! Can you make the HTML to show the recipes availables on that shop??? For newbies without information about the recipes, it would be nice to have more than 1 configurable shop for purposesā€¦ like drugs, or Miner, Lumberjackā€¦ It would be E P I C.

Thanks for your hard work!

This is necessary

Hi guys, iā€™d like to share my config for weapon crafting, if it result useful for scratch, iā€™m happy.

add this to your config.lua

	-- CLIP
	["clip"] = { 
		{item = "bulletshell", quantity = 5 }, 
		{item = "gunpowder", quantity = 5 },
	},

	-- CULATA
	["culata"] = { 
		{item = "scrapmetal", quantity = 5 }, 
		{item = "rubberband", quantity = 5 }, --DT
		{item = "scrapplastic", quantity = 5},
	},

	-- CAƑON
	["barrel"] = { 
		{item = "scrapmetal", quantity = 30 }, 
		{item = "tape", quantity = 5 }, --DT
		{item = "scrapplastic", quantity = 15},
	},
	
	-- ARMAZON AK
	["body_ak"] = { 
		{item = "cutted_wood", quantity = 50 }, 
		--{item = "fixtool", quantity = 1, remove = false}, -- fixtool? (Herramientas) equipada sin quitarla
		{item = "scrapmetal", quantity = 10 }, 
		{item = "scrapplastic", quantity = 5 }, 
		{item = "tape", quantity = 5},
		{item = "tornillo", quantity = 100},
	},	
	
	-- WEAPON_ASSAULTRIFLE (AK47)
	['WEAPON_ASSAULTRIFLE'] = { 
		{item = "body_ak", quantity = 1 }, 
		{item = "scrapmetal", quantity = 10 }, 
		{item = "scrapplastic", quantity = 5 }, 
		{item = "tape", quantity = 5},
		{item = "tornillo", quantity = 60},
		{item = "clip", quantity = 2},
		{item = "barrel", quantity = 1},
		{item = "culata", quantity = 1},
	},

Add this to your db

 INSERT INTO `items` (name, label, `limit`) VALUES
  ('clip','Cargador', 10),
  ('scrapmetal', 'Trozo de Metal', 100),
  ('scrapplastic', 'Trozo de Plastico', 100),
  ('rubberband', 'Gomita Elastica', 200),
  ('bulletshell', 'Casquillo de Bala', 200),
  ('gunpowder', 'Polvora', 200),
  ('tape', 'Cinta Multiuso', 50),
  ('tornillo', 'Tornillo', 250),
  ('body_ak', 'Cuerpo de AK-47', 5),
  ('barrel', 'CaƱon', 5),
  ('culata', 'Culata', 5)
 ;

if you want to add more items, do it.

If you want some idea to WHERE to retrieve those items beside shops or jobs (like cutted_wood from Lumberjack), try esx-ecobottles script and just add there the items you want to pick up from the bins. (Default math.random is 100, i made it to 1000 to get more variety of pickups)

I want this plugin to be multi shop so badā€¦SO BAD!!!

1 Like

[ā€œbag_of_weedā€] = {
{item = ā€œweedā€, quantity = 7 },
{item = ā€œbaggieā€, quantity = 1 }, ā€“ Could be commented out if you rather not use a plastic baggie. Just something to consider for more realism if RP server.
},

I will increase the chance How the success of each weapon Now, can I make all the chances of success, but will it be based on the weapon?

RegisterServerEvent('salty_crafting:craftItem')
AddEventHandler('salty_crafting:craftItem', function(ingredients)
	local _source = source
	local xPlayer = ESX.GetPlayerFromId(_source)
	local item = findRecipe(ingredients)
	local rate = math.random( 0 , 100 )
	if not item then
		TriggerClientEvent('esx:showNotification', _source, 'No recipe found with these ingredients')
	else
		if xPlayer ~= nil then
			if hasAllIngredients(xPlayer.inventory, Config.Recipes[item]) then
				for _,ingredient in pairs(Config.Recipes[item]) do
					if (ingredient.remove ~= nil and ingredient.remove) or (ingredient.remove == nil) then
						xPlayer.removeInventoryItem(ingredient.item, ingredient.quantity)
					end
				end

				if rate <= 50 then
				if string.match(string.lower(item), "weapon_") then
					xPlayer.addWeapon(item, Config.WeaponAmmo)
				else
					xPlayer.addInventoryItem(item, 1)
				end
				end
				TriggerClientEvent('esx:showNotification', _source, '~y~Item Crafted: ~w~' .. itemLabel(item, xPlayer.inventory))
			else
				TriggerClientEvent('esx:showNotification', _source, 'You do not have all of the ingredients')
			end
		end
	end
end)

now i wonder about this,

how would we make it so that we could config 1 and then it could craft all multiples of that, so we dont have to input a config for 1 2 3 4 of these types of item

also, is it possible to make the keybind menu come up with 2 keys being pressed

how can i display only on the list of Config.Recipes, and not the player existing inventory items?

Any way to configure a second shop? i want to put one in PD for the cops to be able to get rid of the items they take off the criminals. I tried a couple ways and couldnā€™t get a second crafting shop to work. Thank you!