Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dumpster Stashes #32

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions client/dumpsters.lua
Original file line number Diff line number Diff line change
@@ -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()
Expand Down Expand Up @@ -81,4 +100,4 @@ if Config.DumpsterDiving.Enable then if Config.Debug then print("^5Debug^7: ^2Lo
ClearPedTasks(Ped)
end
end)
end
end
4 changes: 3 additions & 1 deletion config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion shared/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -167,4 +169,4 @@ function progressBar(data)
end
while result == nil do Wait(10) end
return result
end
end