vending.lua
The complete default vending.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 = 5, -- Cooldown until a vending machine is robbable again. (in minutes)
Items = { 'WEAPON_HAMMER' }, -- Tools (any one is enough)
Time = 8, -- Time in seconds it takes to rob a vending machine. (progressbar time)
BaseXP = 8, -- Base XP awarded for successful vending machine robbery
GiveXPForItems = true, -- Whether to give additional XP based on items received
GiveXPForCash = false, -- Whether to give 1 XP per cash received
Models = { -- Props to create interaction points for
'prop_vend_snak_01',
'prop_vend_snak_01_tu',
'prop_vend_water_01',
'prop_vend_soda_01',
'prop_vend_soda_02',
'prop_vend_fags_01',
'prop_vend_coffe_01',
'v_serv_vend_machne1',
},
Logging = true, -- Enables lib.logger usage for this action.
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 `holdSteady`
-- 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').holdSteady({
bandSize = 0.22, -- target band size (fraction of track)
holdDurationSec = 2.5, -- in-band dwell needed to win
gravity = 1.2, -- downward pull on the marker
thrust = 2.6, -- upward push while holding E
dwellDrainRate = 0.6, -- how fast dwell bleeds when off-band
timeLimitSec = 12, -- seconds before caught; 0 = no limit
}).success
end,
},
PoliceAlert = {
Enable = true, -- Enable/disable police alerts for vending machine robberies
Chance = 30, -- 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 = 'Vending machine 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 = data.coords,
title = '10-15 - Vending Theft',
message = ('A %s breaking into a vending machine at %s'):format(data.sex, data.street),
flash = 0,
unique_id = data.unique_id,
sound = 1,
blip = {
sprite = 431,
scale = 1.2,
colour = 3,
flashes = false,
text = '911 - Vending Theft',
time = 5,
radius = 0,
}
})
--]]
end,
},
-- Cash payout from the coin slot. Independent of the item roll below.
Cash = {
[1] = { min = 4, max = 12 }, -- Level 1 (basic)
[2] = { min = 8, max = 20 }, -- Level 2 (improved)
[3] = { min = 15, max = 35 }, -- Level 3 (advanced)
},
-- Snack/drink loot rolled per successful break-in. Same shape as
-- mailbox/shoplift — single weighted-chance pick from the level bucket.
Rewards = {
[1] = { -- Level 1 rewards (basic)
{ item = 'water_bottle', chance = 35, min = 1, max = 2, xp = 1 },
{ item = 'fruit_candy', chance = 30, min = 1, max = 2, xp = 1 },
},
[2] = { -- Level 2 rewards (improved)
{ item = 'water_bottle', chance = 30, min = 2, max = 3, xp = 1 },
{ item = 'fruit_candy', chance = 30, min = 2, max = 3, xp = 1 },
{ item = 'flour', chance = 20, min = 1, max = 2, xp = 2 },
},
[3] = { -- Level 3 rewards (advanced)
{ item = 'water_bottle', chance = 25, min = 3, max = 4, xp = 1 },
{ item = 'fruit_candy', chance = 25, min = 3, max = 4, xp = 1 },
{ item = 'flour', chance = 25, min = 2, max = 3, xp = 2 },
{ item = 'bread', chance = 20, min = 1, max = 2, xp = 3 },
},
},
}