[ESX][Free]Portable Methlab! Meth producing anywhere you want

Description:
As in Title.Simple drugs script. Adding new item: Portable Methlab which you can use anywhere you want and start to produce Meth at your own. System is based on events, that you can change and make your own recipes. Also included lvl and xp system. Every 2 lvls, you have 1 more meth guaranteed from every cooking. There is a chance to explode after one bad choice, so be careful.

This is my second script in Lua, so if there are any problems, feel free to let me know.

Comments

Drug sales are not included. It has to be done with the help of other scripts, eg Esx_Drugs. The name of the item we get after cooking is ‘meth’. You can change this on line 37 of server.lua, or add a sale item in your script to sell drugs. If you already have an item named ‘meth’ in your database, just don’t add it.
You can change time for answer, events count, explosion chance, and amount of meth that you can possible get from one cooking( it gives Randomamount + the one you get from your lvl) in Config.
And don’t change folder name, or change some stuff in index.js or it won’t work.

Enjoy your cooking, and don’t mess something up, or you will see biiiig explosion.

Can add more event in client.lua line 29 to 48. If you want to change buttons names, go to index.html.

Download link >> Download Methjob<<

Youtube showcase >> How does it look like

UPDATE 1.0.1
Added

  • Selling event, there is a guy who you can talk with, he will give you car and show delivery destination. All configurable in Config.exe
  • Price of your meth depends on your lvl, there are changes in lvls 1, 3 ,5 , 9
  • Let me know what would you like to see in next updates
    UPDATE VIDEO

UPDATE 1.0.2
Added

  • Animations
  • Time to put the table down or hide it
  • From now you can hide the table even if it is on the ground if you’re not cooking

UPDATE 1.0.3
Added

4 Likes

The video demonstration at night really shows what is happening, it’s not like nothing is visible.

Better video added! Sorry for that

1 Like

dope, pun intended.

1 Like

this is nice drugs script, thanks you for this release

1 Like

Thank you guys <3

One of our members got this issue do you know the fix? extended mode here - not getting any items when finished…

Did you add item ‘meth’ to your datebase? Show me your server-side code.

  
  
ESX = nil

TriggerEvent('tac:getSharedObject', function(obj) ESX = obj end)

ESX.RegisterUsableItem('table', function(playerId)
    local xPlayer = ESX.GetPlayerFromId(playerId)
    TriggerClientEvent("methjob_place", playerId)
end)

RegisterNetEvent("DeleteTable")
AddEventHandler("DeleteTable", function()
	local xPlayer = ESX.GetPlayerFromId(source)
	xPlayer.removeInventoryItem('table', 1)
end)

RegisterNetEvent("AddTable")
AddEventHandler("AddTable", function()
	local xPlayer = ESX.GetPlayerFromId(source)
	xPlayer.addInventoryItem('table', 1)
end)

RegisterNetEvent("Sell")
AddEventHandler("Sell", function()
	local _source = source
	local xPlayer = ESX.GetPlayerFromId(_source)
	amount = xPlayer.getInventoryItem('meth').count
	print("xDDDD")
	local result = MySQL.Sync.fetchAll("SELECT * FROM users WHERE identifier = @identifier", {["@identifier"] = xPlayer.identifier})
	if result[1].lvl == 1 or result[1].lvl == 2 then
		TriggerClientEvent("methjob_notify", _source, "This is some shitty stuff. I will pay maximum " .. Config.prices.lvl1 ..  " per each Meth", "info")
		xPlayer.addMoney(amount* Config.prices.lvl1)
		TriggerClientEvent("methjob_notify", _source, "You sold! " .. amount ..  " meth for " .. amount* Config.prices.lvl1 .. " $", "Success")
	elseif result[1].lvl == 3 or result[1].lvl == 4 then
		TriggerClientEvent("methjob_notify", _source, "This isn't the worst but isn't the best stuff. I will pay " .. Config.prices.lvl3 ..  " per each Meth", "info")
		xPlayer.addMoney(amount* Config.prices.lvl3)
		TriggerClientEvent("methjob_notify", _source, "You sold! " .. amount ..  " meth for " .. amount* Config.prices.lvl3 .. " $", "Success")
	elseif result[1].lvl == 5 or result[1].lvl == 6 or result[1].lvl == 7 or result[1].lvl == 8 then
		TriggerClientEvent("methjob_notify", _source, "This is good men! I like this stuff. I will pay " .. Config.prices.lvl5 ..  " per each Meth", "info")
		xPlayer.addMoney(amount* Config.prices.lvl5)
		TriggerClientEvent("methjob_notify", _source, "You sold! " .. amount ..  " meth for " .. amount* Config.prices.lvl5 .. " $", "Success")
	else
		TriggerClientEvent("methjob_notify", _source, "This stuff is fukkin amazing! I love it men! " .. Config.prices.lvl10 ..  " per each Meth", "info")
		xPlayer.addMoney(amount* Config.prices.lvl10)
		TriggerClientEvent("methjob_notify", _source, "You sold! " .. amount ..  " meth for " .. amount* Config.prices.lvl10 .. " $", "Success")
	end
	xPlayer.removeInventoryItem('meth', amount)
end)

RegisterNetEvent("Update")
AddEventHandler("Update", function(amountxp, amountmeth)
	local _source = source
	local xPlayer = ESX.GetPlayerFromId(_source)

	local result = MySQL.Sync.fetchAll("SELECT * FROM users WHERE identifier = @identifier", {["@identifier"] = xPlayer.identifier})
	local newAmount = 0
	currentXp = result[1].xp
	currentLvl = result[1].lvl
	if(currentLvl%2 == 0.0) then
	 newAmount = amountmeth + (0.5*currentLvl)
else
	 newAmount = (amountmeth + (0.5*currentLvl))-0.5
end
	xPlayer.addInventoryItem('meth', newAmount)
	TriggerClientEvent("methjob_notify", _source, "Cooking time is over. You cooked " .. newAmount .. " meth", "success")
	xPlayer.addInventoryItem('table', 1)
	if(currentLvl<40) then
	if(currentXp + amountxp >= 100+ (currentLvl*50) ) then
		MySQL.Async.fetchAll("UPDATE users SET xp = @xp WHERE identifier = @identifier", {["@identifier"] = xPlayer.identifier, ["@xp"]= (currentXp + amountxp)-(100 + (currentLvl*50))}, function(result)
end) 
		MySQL.Async.fetchAll("UPDATE users SET lvl = lvl + @lvl WHERE identifier = @identifier", {["@identifier"] = xPlayer.identifier, ["@lvl"] = 1}, function(result)
end) 
		TriggerClientEvent("methjob_update", _source, (((currentXp+ amountxp)- (100+50*currentLvl))/(100+ (50*(currentLvl+1))))*100, amountxp)
 else
   MySQL.Async.fetchAll("UPDATE users SET xp = xp + @xp WHERE identifier = @identifier", {["@identifier"] = xPlayer.identifier, ["@xp"]= amountxp}, function(result)
end)
  TriggerClientEvent("methjob_update", _source, ((currentXp+amountxp)/(100+(50*currentLvl)))*100, amountxp)
end
else
	TriggerClientEvent("methjob_notify", _source, "You didn't get any more experience. You have maximum level", "error")
end
end)

thats the server cfg
yes of course meth is in

Seems like Event “Update” isn’t working at all. Do you have multi-characters? Or is there any error in console?Or did you changed something in the code? If you did, let me see. And this i global problem, or only one person?

global yes i have mf multicharacter

Nice job :smiley:

Thanks man !

I am also not getting anything when the cooking is over. I have added the item meth into my db as well.

If you can get this one to work I will gladly look into getting the v2 script.

The v2 script works perfectly fine, i’m not into supporting this script anymore, but
I encourage you to look out v2 version

I did look at v2. This script doesn’t say anywhere that you aren’t supporting it anymore but since you failed to even attempt to try and figure out what might be the issue here it says all I needed to know. If you would have got this one to work and shown good support on your product you would have up sold me on the paid version. You didn’t even attempt to though, so I won’t pay for a script since you showed a lack of caring for support of you products. I’ll just go elsewhere. Thank you though.

I don’t really understand why you think that i don’t give support. I remade this script for a reason, just check the comments on V2 script. This free version was remade, because is unstable and i don’t want to work on it anymore. That’s why it’s free and don’t update it anymore. But i wish that you will find what are you looking for. Thanks for your opinion !