diff --git a/client/dumpsters.lua b/client/dumpsters.lua index 572aa0c..3c99344 100644 --- a/client/dumpsters.lua +++ b/client/dumpsters.lua @@ -1,12 +1,31 @@ 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 - exports['qb-target']:AddTargetModel(Config.DumpsterDiving.models, + + --Dumpster Third Eye + if Config.DumpsterStash then + exports['qb-target']:AddTargetModel(Config.DumpsterDiving.models, { options = { { event = "jim-recycle:Dumpsters:Search", 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 = { { event = "jim-recycle:Dumpsters:Search", icon = "fas fa-dumpster", label = Loc[Config.Lan].target["search_trash"], }, }, distance = 1.5 }) + end --Search animations local function startSearching(coords) local Ped = PlayerPedId() @@ -81,4 +100,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..460dcb5 100644 --- a/config.lua +++ b/config.lua @@ -10,7 +10,9 @@ Config = { Menu = "qb", 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/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