[ESX] [Well Optimized] Search dumpsters

Oh okay, was it the “canCarryItem” native? cause don’t think the older es_extended got that native.

Glad you solved it tho! :slight_smile:

in the github server side main lua:
TriggerEvent(“esx:getSharedObject”, function(library)

in my script main lua:
TriggerEvent(“esx:getSh0nixACaredObj0nixACect”, function(library)

i don’t know what was wrong,but i corrected these lines in both main.lua and it works now

So it tells me when i find nothing but when I found something nothing comes into inventory. Checking the console it gives me this error

@baz_dumpsters/server/main.lua:17: attempt to call a nil value (field ‘canCarryItem’)

Not sure how to fix this

2 Likes

How could i make it where there is an additional section for rare items. Where you can only get 1 of that specific item, and only hold one. Was thinking a scenario for finding items to do bank robberies and heists.
config.lua
Rares = { -- Add whatever items you want here. "id_card_f", "secure_card"
server.lua

      if luck == 4 then
          local randomItem = Config["Items"][math["random"](#Config["Items"])]
          local quantity = math["random"](#Config["Items"])
          local itemLabel = ESX["GetItemLabel"](randomItem)
  		else 
  	if luck == 6 then
  		randomItem = Config["Rares"][math["random"](#Config["Rares"])]
  		quantity = 1
          if player["canCarryItem"](randomItem, quantity) then
              player["addInventoryItem"](randomItem, quantity)
              cb(true, itemLabel, quantity)
          else
              cb(false)
          end
      else

Hi! Can i use this with progressBars

why only picks up weapons on search?
i changed the config with the items from my db, it doesnt find items only guns…

did u figured it out how to fix this problem?

1 Like

when i find something it doesnt tell me anything i got. help me please?

Remove the canCarryItem function since you are using an old version of es_extended.

1 Like

Dont work for me…
any help?

Only change the IP if you’re using a server with multiple network interfaces, otherwise change the port only.

endpoint_add_tcp “0.0.0.0:30120”
endpoint_add_udp “0.0.0.0:30120”

add_ace resource.essentialmode command.sets allow
add_ace resource.essentialmode command.add_principal allow
add_ace resource.essentialmode command.add_ace allow

These resources will start by default.

start essentialmode
ensure mapmanager
ensure chat
ensure spawnmanager
ensure sessionmanager
ensure fivem
ensure hardcap
ensure ■■■■■■■
ensure scoreboard

Anyone know any script for wepons crafting that works with the materials that you find with this script?
Thanks

Hey, great script. Its exactly what i was looking for, for my survival server. The only Problem i have, is instead of receaving an Item, i get the error: es_extended: TriggerServercallback => [baz_dumpsters] does not exist. Any Idea what i’ve done wrong?

Try out salty crafting. There you can make your own recepies with items from your database

how can i make this give me 1 item instead of a random amount

In the server.lua you have to change the “math.random” of each item you want to change.
Here is the endline of glassbottle

quantity = math.random(1,3)

If you only want 1x of them change it to

quantity = 1,

I Hope it is what you need and ask for :slight_smile:

1 Like

I already figured it out but thanks anyways :ok_hand:t2:

1 Like

someone have the script no errors?

I really need help. Everything works but i dont get an item into the inventory

Does anyone know how to increase the probability of finding something i have searched 30 bins but not got one item from any of them all the items are in and in the SQL the bin searching script is working fine but just keep getting you have found nothing