I converted this to vrp 0.5.
You can download it from this link.
Download
You converted this just to advertise a script selling store on your github repo, I don’t mind you converting my scripts to vRP but do the decent thing and stop breaking FiveM TOS while you’re at it.
EDIT: Thanks for removing the discord link
Neat script, going to check it out.
Off-topic: why do ya’ll always copy NoPixel’s HUD instead of going for something unique and different?
Awesome script. I like your version better then the other ones out there. Nicely done!
because its unique and looks decent compared to others
[ESX] Search dumpsters Now you have seen it. Your code is different tho, so not saying you coppied anything. Just letting you know it exist.
Great release! Thank you. Only thing I would change is to add a sleep in the main thread as to not run so high when you are not by a dumpster. This is all I did:
Citizen.CreateThread(function()
while true do
sleep = 500
if canSearch then
local ped = GetPlayerPed(-1)
local pos = GetEntityCoords(ped)
local dumpsterFound = false
for i = 1, #dumpsters do
local dumpster = GetClosestObjectOfType(pos.x, pos.y, pos.z, 1.0, dumpsters[i], false, false, false)
local dumpPos = GetEntityCoords(dumpster)
local dist = GetDistanceBetweenCoords(pos.x, pos.y, pos.z, dumpPos.x, dumpPos.y, dumpPos.z, true)
if dist < 1.8 then
sleep = 5
DrawText3Ds(dumpPos.x, dumpPos.y, dumpPos.z + 1.0, 'Flex [~y~H~w~] to dumpster dive')
if IsControlJustReleased(0, 74) then
for i = 1, #searched do
if searched[i] == dumpster then
dumpsterFound = true
end
if i == #searched and dumpsterFound then
exports['mythic_notify']:DoHudText('error', 'You already searched this dumpster')
elseif i == #searched and not dumpsterFound then
startSearching(searchTime, 'amb@prop_human_bum_bin@base', 'base', 'onyx:giveDumpsterReward')
TriggerServerEvent('onyx:startDumpsterTimer', dumpster)
table.insert(searched, dumpster)
end
end
end
end
end
end
Citizen.Wait(sleep)
end
end)
``` Hope this helps
So much better then other similar resources I’ve seen!
However, It’d be cool if it checked how much of an item you have in your inventory before you’re allowed to search it or just not give you any more if => a number. I tried to write it myself but failed miserably
@Shelby_Moon yeah that could be implemented, if they have too much of one item it could just reroll good idea.
@Geerdodagr8 yeah, to be fair I rushed this and completely forgot. Thanks that will improve performance.
Nice script
Updated the script to allow for limiting the amount of items you get from dumpster diving as requested by @Shelby_Moon. To allowed for unlimited amounts of an item just change the value to 0.
[1] = {chance = 2, id = 'glassbottle', name = 'Glass Bottle', quantity = math.random(1,3), limit = 10}, -- max 10
[5] = {chance = 3, id = 'plastic', name = 'Plastic', quantity = math.random(1,8), limit = 0}, -- unlimited
Hey, I did this but that resulted in flashing of hud text. Although this has definitely improved the performance a lot.
Idea: It would also make sense if only the unemployed were allowed to search trash cans.
You did the sleep = 5 ?? You can do sleep = 1 and see if that changes anything for you
What you can do is if you’re at a distance of > 10 then sleep, whenever you’re close keep the sleep at 0. Which is what I’ve currently done, since it’s drawing text it kind of needs to be 0.
I got this down to 0.23 then just decided to make my own, thanks anyway, good idea
If he takes out the constant sweep of checking for dumpsters the resource would take less time.
Hi, sorry not been around much.
This is what I done to bring the resource usage down
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if canSearch then
local ped = GetPlayerPed(-1)
local pos = GetEntityCoords(ped)
local dumpsterFound = false
local dumpsterAround = false
for i = 1, #dumpsters do
local dumpster = GetClosestObjectOfType(pos.x, pos.y, pos.z, 1.0, dumpsters[i], false, false, false)
local dumpPos = GetEntityCoords(dumpster)
local dist = GetDistanceBetweenCoords(pos.x, pos.y, pos.z, dumpPos.x, dumpPos.y, dumpPos.z, true)
if dumpster then
dumpsterAround = true
end
if dist < 1.8 then
DrawText3Ds(dumpPos.x, dumpPos.y, dumpPos.z + 1.0, 'Press [~y~H~w~] to dumpster dive')
if IsControlJustReleased(0, 74) then
for i = 1, #searched do
if searched[i] == dumpster then
dumpsterFound = true
end
if i == #searched and dumpsterFound then
exports['mythic_notify']:DoHudText('error', 'You already searched this dumpster')
elseif i == #searched and not dumpsterFound then
startSearching(searchTime, 'amb@prop_human_bum_bin@base', 'base', 'onyx:giveDumpsterReward')
TriggerServerEvent('onyx:startDumpsterTimer', dumpster)
table.insert(searched, dumpster)
end
end
end
end
end
if not dumpsterAround then
Citizen.Wait(5000)
end
end
end
end)