diff --git a/client/dumpsters.lua b/client/dumpsters.lua index 8ef27d0..74567cf 100644 --- a/client/dumpsters.lua +++ b/client/dumpsters.lua @@ -1,6 +1,29 @@ if Config.DumpsterDiving.Enable then if Config.Debug then print("^5Debug^7: ^2Loading^7: '^6Dumpster Diving^7'") end local Searching = false -- No touch --Dumpster Third Eye + if Config.DumpsterStash then + exports['qb-target']:AddTargetModel(Config.DumpsterDiving.models, + { options = { + { + action = function(entity) TriggerEvent("jim-recycle:Dumpsters:Search", { entity = entity }) end, + icon = "fas fa-dumpster", + label = Loc[Config.Lan].target["search_trash"], + }, + { icon = 'fas fa-dumpster', label = Loc[Config.Lan].target["dump_stash"], action = function(entity) + local DumpsterCoords = GetEntityCoords(entity) + if DumpsterCoords.x < 0 then DumpsterX = -DumpsterCoords.x else DumpsterX = DumpsterCoords.x end + if DumpsterCoords.y < 0 then DumpsterY = -DumpsterCoords.y else DumpsterY = DumpsterCoords.y end + DumpsterX = getCoord(DumpsterX, 1) + DumpsterY = getCoord(DumpsterY, 1) + TriggerEvent("inventory:client:SetCurrentStash", "Dumpster | "..DumpsterX.." | "..DumpsterY) + TriggerServerEvent("inventory:server:OpenInventory", "stash", "Dumpster | "..DumpsterX.." | "..DumpsterY, { + maxweight = 100000, + slots = 10, + }) + end + } + }, distance = 1.5 }) + else exports['qb-target']:AddTargetModel(Config.DumpsterDiving.models, { options = { { @@ -9,6 +32,7 @@ if Config.DumpsterDiving.Enable then if Config.Debug then print("^5Debug^7: ^2Lo label = Loc[Config.Lan].target["search_trash"], }, }, distance = 1.5 }) + end --Search animations local function startSearching(coords) local Ped = PlayerPedId() @@ -83,4 +107,4 @@ if Config.DumpsterDiving.Enable then if Config.Debug then print("^5Debug^7: ^2Lo ClearPedTasks(Ped) end end) -end \ No newline at end of file +end diff --git a/config.lua b/config.lua index 5e566bd..6bd8971 100644 --- a/config.lua +++ b/config.lua @@ -11,6 +11,8 @@ Config = { ProgressBar = "qb", Notify = "qb", + DumpsterStash = true, -- Set to true if you want to turn on the dumpster stashes + Overrides = { ScrapyardSeraching = true, DumpsterDiving = true, diff --git a/locales/en.lua b/locales/en.lua index 4a3d947..bbc903a 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -29,6 +29,7 @@ Loc["en"] = { ["search"] = "Search", ["drop_off"] = "Drop Off", ["search_trash"] = "Search Trash", + ["dump_stash"] = "Dump Stash", }, menu = { ["close"] = "Close", diff --git a/shared/functions.lua b/shared/functions.lua index b18cdb1..75133fa 100644 --- a/shared/functions.lua +++ b/shared/functions.lua @@ -36,6 +36,8 @@ function makeProp(data, freeze, synced) return prop end +function getCoord(numA, numB) local base = 10^(numB or 0) return math.floor(numA * base + 0.5) / base end + function destroyProp(entity) if Config.Debug then print("^5Debug^7: ^2Destroying Prop^7: '^6"..entity.."^7'") end SetEntityAsMissionEntity(entity) Wait(5) @@ -167,4 +169,4 @@ function progressBar(data) end while result == nil do Wait(10) end return result -end \ No newline at end of file +end