Skip to content

smashgrab.lua

The complete default smashgrab.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.

Download smashgrab.lua

lua
return {
    -- Skill-check minigame run during the grab. Enable = false to skip it. Swap
    -- `whack` for any other minigame.* (see client/minigame.lua) or your own
    -- function returning true/false.
    Minigame = {
        Enable = true,
        Start = function()
            return require('client.minigame').whack({
                hits          = 8,   -- targets to hit to win
                maxMisses     = 3,   -- expired targets allowed before caught
                targetLifeSec = 1.1, -- seconds each target stays
                spawnEverySec = 0.7, -- seconds between spawns
            }).success
        end,
    },

    Cooldown = 15, -- Per-location cooldown in minutes before the box respawns.
    Items = { 'WEAPON_HAMMER' }, -- Tools (any one is enough).
    SmashTime = 3, -- Seconds to smash window + grab the box.
    BaseXP = 18, -- Base XP awarded for a successful smash-and-grab.
    GiveXPForItems = true, -- Whether to give additional XP based on items received.
    Logging = true, -- Enables lib.logger usage for this action.

    BoxModel = 'hei_prop_heist_box', -- Visible box prop attached to the passenger seat.

    -- Pool of civilian car models the server randomises one from for each
    -- spawn point at resource start. Pick beat-up sedans by default — fits
    -- the "left a package on the front seat" carelessness vibe.
    VehicleModels = {
        'asea',
        'emperor',
        'fugitive',
        'premier',
        'primo',
        'stanier',
        'washington',
        'ingot',
        'asterope',
        'intruder',
    },

    PoliceAlert = {
        Enable = true,
        Chance = 65, -- Window-smash + alarm = high alert chance.
        Send = function()
            local alertMessage = 'Vehicle break-in 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-21V - Vehicle Break-in',
                message = ('A %s smashed a car window and grabbed something at %s'):format(data.sex, data.street),
                flash = 0,
                unique_id = data.unique_id,
                sound = 1,
                blip = {
                    sprite = 380,
                    scale = 1.2,
                    colour = 1,
                    flashes = true,
                    text = '911 - Vehicle Break-in',
                    time = 5,
                    radius = 0,
                }
            })
            --]]
        end,
    },

    -- Loot bucket per player level. Single weighted-chance pick on success
    -- — the box on the seat is *the* drop, so the loot represents what
    -- happened to be inside it.
    Rewards = {
        [1] = { -- Level 1 — basic
            { item = 'phone',         chance = 30, min = 1, max = 1, xp = 6  },
            { item = 'gold_watch',    chance = 25, min = 1, max = 1, xp = 8  },
            { item = 'goldchain',     chance = 20, min = 1, max = 1, xp = 8  },
            { item = 'package',  chance = 15, min = 1, max = 1, xp = 5  },
            { item = 'metalscrap',    chance = 25, min = 1, max = 3, xp = 1  },
        },
        [2] = { -- Level 2 — improved
            { item = 'phone',         chance = 25, min = 1, max = 2, xp = 6  },
            { item = 'gold_watch',    chance = 22, min = 1, max = 2, xp = 8  },
            { item = 'goldchain',     chance = 22, min = 1, max = 2, xp = 8  },
            { item = 'rolex',         chance = 15, min = 1, max = 1, xp = 10 },
            { item = 'laptop',        chance = 12, min = 1, max = 1, xp = 12 },
            { item = 'package',  chance = 18, min = 1, max = 2, xp = 5  },
        },
        [3] = { -- Level 3 — advanced
            { item = 'gold_watch',    chance = 22, min = 1, max = 3, xp = 8  },
            { item = 'goldchain',     chance = 20, min = 1, max = 3, xp = 8  },
            { item = 'rolex',         chance = 18, min = 1, max = 2, xp = 10 },
            { item = 'laptop',        chance = 18, min = 1, max = 2, xp = 12 },
            { item = '10kgoldchain',  chance = 12, min = 1, max = 1, xp = 20 },
            { item = 'diamond_ring',  chance = 8,  min = 1, max = 1, xp = 25 },
            { item = 'package',  chance = 15, min = 1, max = 2, xp = 5  },
        },
    },

    -- Spawn points around Los Santos. Each location's vehicle model is
    -- chosen randomly from `VehicleModels` at server start.
    --
    -- `coords` + `heading` define where the parked car appears.
    -- `distance` is the streaming radius (player must enter to see the spawn).
    Locations = {
        -- Vespucci Beach parking lot
        { coords = vector3(-1209.74, -1488.89, 4.16),  heading = 122.74, distance = 30.0 },
        { coords = vector3(-1198.86, -1483.07, 4.16),  heading = 122.74, distance = 30.0 },
        -- Del Perro
        { coords = vector3(-1640.34, -1116.05, 13.05), heading = 35.55,  distance = 30.0 },
        { coords = vector3(-1391.06,  -606.88, 30.21), heading = 33.40,  distance = 30.0 },
        -- Legion Square
        { coords = vector3(  211.79,  -872.46, 30.51), heading = 339.92, distance = 30.0 },
        { coords = vector3(  239.31,  -871.04, 30.49), heading = 339.13, distance = 30.0 },
        -- Maze Bank Tower
        { coords = vector3(  -68.19,  -763.57, 32.84), heading = 250.13, distance = 30.0 },
        -- Mission Row alley parking
        { coords = vector3(  423.66,  -805.98, 29.49), heading = 0.42,   distance = 30.0 },
        -- LSIA short-term parking
        { coords = vector3(-1067.88, -2839.82, 13.85), heading = 240.20, distance = 30.0 },
        -- Sandy Shores convenience store
        { coords = vector3( 1959.45, 3744.17, 32.34),  heading = 122.65, distance = 30.0 },
        -- Paleto Bay general store
        { coords = vector3( -171.67, 6324.37, 31.49),  heading = 134.44, distance = 30.0 },
        -- Grove Street area
        { coords = vector3(   85.66,-1957.12, 20.75),  heading = 358.66, distance = 30.0 },
    },
}