[Release][ESX] Crafting System

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!

You could set the menu prompt as a server event and have a marker in MRPD or wherever you want it that lets you call for the server event that opens the menu.

There are of course other ways of doing it, this is off the top of my head.

Okay sounds good i will try that. Thank you

Do you not add this to server CFG?

how to use money or blackmoney for crafting @SaltyGrandpa

Where can I download the items, “rings, morphine” etc…

you cant enter the number of the ingredients or? because clicking to 50 is a bit painfull

but it works great and the menu is looking so clean,i love it
thx !

1 Like

+1
Its good idea.

nice job