NX Dumpster Diving

Configuration

Every option in config.lua explained.

Everything is configured in config.lua. Restart the resource after making changes. The loot table, the pawn buyers and the security settings have their own pages:

General

config.lua
Config.Debug = false
Config.Notify = 'ox'

Config.CustomNotify = function(message, type)
    -- type is 'success', 'error' or 'inform'
    -- exports['your_notify']:Notify(message, type)
end
Config.Debugbooleandefault: false
Prints extra information in the server console. Leave it off on a live server.
Config.Notify'ox' | 'esx' | 'custom' | falsedefault: 'ox'
Which notification system to use. ox uses ox_lib, esx uses ESX notifications, custom calls Config.CustomNotify, and false turns notifications off.
Config.CustomNotifyfunction
Only used when Config.Notify = 'custom'. It receives the message and a type of success, error or inform.

Custom notify example

config.lua
Config.Notify = 'custom'

Config.CustomNotify = function(message, type)
    exports['okokNotify']:Alert('Dumpster Diving', message, 5000, type == 'inform' and 'info' or type)
end

Searching

config.lua
Config.SearchType = 3

Config.Search = {
    duration = 7500,
    distance = 2.0,
    dumpsterCooldown = 600,
    playerCooldown = 0,
    emptyChance = 30,
    rolls = { min = 1, max = 2 },
    anim = { dict = 'amb@prop_human_bum_bin@base', clip = 'base' },
}
Config.SearchType1 | 2 | 3default: 3
1 only big dumpsters (Config.DumpsterModels), 2 only small trash cans and street bins (Config.TrashCanModels), 3 both.
durationnumber (ms)default: 7500
How long a search takes. Players can cancel it.
distancenumberdefault: 2.0
Third eye distance for dumpsters.
dumpsterCooldownnumber (s)default: 600
How long before the same dumpster can be searched again. Shared by all players, so a dumpster someone just searched is empty for everyone. Cancelling a search frees the dumpster straight away.
playerCooldownnumber (s)default: 0
How long a player must wait between searches of any dumpster. 0 means no wait.
emptyChancenumber (%)default: 30
Chance a finished search finds nothing at all. The dumpster still goes on cooldown.
rolls{ min, max }default: { min = 1, max = 2 }
How many times the loot table is rolled on a successful search. See Loot & Items.
anim{ dict, clip }default: bin search anim
Animation played while searching.

Adding your own dumpster props

Add the model name to Config.DumpsterModels or Config.TrashCanModels, wrapped in backticks. This works for custom map props too.

config.lua
Config.DumpsterModels = {
    `prop_dumpster_01a`,
    -- ...
    `my_custom_dumpster`,
}

Not sure what a prop is called? Most dev tools and map editors (or a GetEntityModel check) will show the model name of the object you're looking at.

Text

Every message players see is in Config.Locale, including the third eye labels, notifications and the sell menu. Translate or reword anything you like. Keep the %s placeholders. They're replaced with amounts, item names and prices.

config.lua
Config.Locale = {
    target_search   = 'Search Dumpster',
    target_pawn     = 'Sell Junk',
    progress_search = 'Digging through the trash...',
    found_item      = 'You found %sx %s',
    pawn_sold       = 'You sold %sx %s for $%s',
    -- ...
}