mailbox.lua
The complete default mailbox.lua for Petty Crime (sd-pettycrime). Use this as a reference or a starting point for your own configuration.
TIP
This is the full, unedited config file. For a detailed explanation of each option, see the Configuration page.
lua
return {
Cooldown = 2, -- Cooldown until a mailbox is robbable again. (in minutes)
Items = { 'WEAPON_HAMMER' }, -- Tools (any one is enough) — used to smash the mailbox open.
Time = 15, -- Time in seconds it takes to look for loot in a mailbox. (progressbar time)
BaseXP = 15, -- Base XP awarded for successful mailbox robbery
GiveXPForItems = true, -- Whether to give additional XP based on items received
Models = { -- Props to create interaction points for
'prop_letterbox_01',
'prop_letterbox_02',
'prop_letterbox_03',
'prop_letterbox_04',
},
Logging = true, -- Enables lib.logger usage for this action. Will log a players source, character name and identifier as well as the action they took and the items and cash they received from it.
Minigame = {
Enable = true, -- Enable/disable custom minigame (if false, no minigame will be used)
Start = function()
-- Runs a built-in minigame and returns pass/fail. Swap `mash` for
-- any other minigame.* (see client/minigame.lua for the full list)
-- or your own function that returns true/false. Tune below.
return require('client.minigame').mash({
fillPerTap = 0.08, -- bar gained per E tap (0..1)
decayPerSec = 0.4, -- bar lost per second (0..1)
timeLimitSec = 6, -- seconds to fill it; 0 = no limit
}).success
end,
},
PoliceAlert = {
Enable = true, -- Enable/disable police alerts for mailbox robberies
Chance = 25, -- Percentage chance (0-100) that police will be alerted
Send = function() -- Client Function
-- Custom function to send police alerts
-- You can integrate with your preferred dispatch system here
-- Basic Example
local alertMessage = "Mailbox tampering reported"
print("Police Alert: " .. alertMessage)
-- Example: cd_dispatch integration (uncomment to use)
--[[
local data = exports['cd_dispatch']:GetPlayerInfo()
TriggerServerEvent('cd_dispatch:AddNotification', {
job_table = {'police'},
coords = coords,
title = '10-15 - Mail Theft',
message = 'A '..data.sex..' tampering with mailbox at '..data.street,
flash = 0,
unique_id = data.unique_id,
sound = 1,
blip = {
sprite = 431,
scale = 1.2,
colour = 3,
flashes = false,
text = '911 - Mail Theft',
time = 5,
radius = 0,
}
})
--]]
end,
},
Rewards = { -- Level-based rewards from robbing mailboxes
-- HOW WEIGHTED CHANCE WORKS:
-- The "chance" number is like putting that many tickets in a hat.
-- Higher chance = more tickets = more likely to be picked.
--
-- Example: cash=10, laptop=50, rolex=25, package=25 tickets
-- Total tickets in hat = 110 tickets
-- laptop has 50/110 = 45% chance to be picked
-- cash has 10/110 = 9% chance to be picked
-- rolex and package each have 25/110 = 23% chance
--
-- You can use any numbers you want - 1, 100, 1000, etc.
-- What matters is the ratio between them!
[1] = { -- Level 1 rewards (basic)
{item = "cash", chance = 15, min = 3, max = 8, xp = 0},
{item = "package", chance = 30, min = 1, max = 1, xp = 5},
{item = "metalscrap", chance = 25, min = 1, max = 2, xp = 2},
},
[2] = { -- Level 2 rewards (improved)
{item = "cash", chance = 12, min = 8, max = 15, xp = 0},
{item = "laptop", chance = 20, min = 1, max = 1, xp = 12},
{item = "rolex", chance = 15, min = 1, max = 1, xp = 8},
{item = "package", chance = 25, min = 1, max = 2, xp = 5},
},
[3] = { -- Level 3 rewards (advanced)
{item = "cash", chance = 10, min = 15, max = 25, xp = 0},
{item = "laptop", chance = 25, min = 1, max = 2, xp = 12},
{item = "rolex", chance = 20, min = 1, max = 2, xp = 8},
{item = "goldchain", chance = 15, min = 1, max = 1, xp = 15},
{item = "package", chance = 20, min = 2, max = 3, xp = 5},
},
},
}