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 mk2 #35

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
26 changes: 25 additions & 1 deletion client/dumpsters.lua
Original file line number Diff line number Diff line change
@@ -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 = {
{
Expand All @@ -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()
Expand Down Expand Up @@ -83,4 +107,4 @@ if Config.DumpsterDiving.Enable then if Config.Debug then print("^5Debug^7: ^2Lo
ClearPedTasks(Ped)
end
end)
end
end
2 changes: 2 additions & 0 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions locales/en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Loc["en"] = {
["search"] = "Search",
["drop_off"] = "Drop Off",
["search_trash"] = "Search Trash",
["dump_stash"] = "Dump Stash",
},
menu = {
["close"] = "Close",
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