ESX Druglabs - Keybased drug system


This script is a more advanced and territorium-based drug system, with a key-based owner system.

How it works
Each lab has its own key, without the necessary key you can’t enter or even see the markers.
Inside of these labs, there is the possibility to produce certain amounts of drugs (at this time only coke and meth). Each lab has its own location and key. System isn’t that advanced at this time but will get more features in the near future.

This form of drug-producing system encourages your players to play smart, since their keys can be stolen by other players - which mean they will no longer have access to the lab.

If you’re wondering why I didn’t use MLO’s instead of IPL’s, its because the key system wouldn’t be as efficient and usefull as it is with teleporters.

You will need to add these items to your (already) existing drug selling resource, or just change the item names in server/main.lua to work with your preffered items.


  • es_extended (1.2)
  • bob74_ipl (or change the code to work with your preffered IPL loader)
  • progressBars

Links for installation can be found in the Github readme. Resource won’t start if these resources aren’t ensured.

Video demonstration

If the video doesn’t work, click here


09/17/2020: First initial release


  • Change up the animations (takes a lot of time to find a good one lmao)
  • Create a new kind of progressbar with a callback function for when the process is finished
  • Clean up some code
  • Implement a weedfarm

Installation and configuration
Information about how to install and configure this resource can be found on the Github page.

Github: -> You can download a zipped version on the ‘releases’ tab. I’ll also create a wiki explaining how you can create your own labs and some other stuff to make it easier to modify and edit.
Support: drop a reply on this topic
I speak fluent English and Dutch.

If you have any ideas and/or tips, feel free to leave a reply.

See y’all later,



Looks interesting and really familiar… Is the storage stored in MySQL? If not, that’s a good idea. Thanks for the release tho.

No, it does not get stored in the database.

Any plans on that?


Wasn’t really planning on doing that to keep database load as low as possible - since Legacy ESX already brings a lot of database load with it.

It also isn’t really neccasary since everything will be saved in the object until your server / script restarts.

Saw that there is a PR created to save the storage in the database, I’ll create a config option and accept the PR in about 10 minutes.

New update to Github got pushed fixing the issue that the callback didn’t return the correct value for keys.

1 Like

any support for esx with count instead of weight? cant get finished product out of storage. I go to get it out and still get nothing. changed the items to ‘coke’ ‘meth’ that you get

As I stated on the other release, please give me an example of how your system gives an item to your player(s), so I can change what needs to be changed.

i just use standard esx system with limit instead of weight

AddEventHandler(“utk_fh:rewardCash”, function()
local xPlayer = ESX.GetPlayerFromId(source)
local reward = math.random(UTK.mincash, UTK.maxcash)

if then
    xPlayer.addAccountMoney("black_money", reward)


not sure if this is the example you are looking for. kinda confused on what you mean

Its because this system is built on ESX weight. I’ll add a config option to change it to the limit system.

1 Like

thank you


  • Added ESX Limit system compatibility through config option.
  • Added Config option to disable key system.



how can i properly change the items from ‘cokebag’ and ‘methbag’ to ‘coke’ and ‘meth’ cause im still having issues where it doesnt give me those that i want changed from the storage.

Replace your server.lua file with this one:
main.lua (2.5 KB)

1 Like

yea thats what i had replaced even tried your new .lua and still not giving me item coke from storage. goes from 1 bag to 0 and gives me nothing.

Any errors in your console?

no none

Weird, if you’re not getting any errors, chance is pretty small that your issue is because of the resource. Are you sure you have both items in your item table?