📝Configurables

In this page, you can see everything that can be configured/changed within this script.

All of the code from frameworks, inventories & such are not displayed in here. This code is triggered within the fmLib dependency script. All of the dependencies code are also opensourced within fmLib.

Config

This is the config.lua from one of the map variants, to give you some more insight in what is changeable in the config of the scripts. All variants their config.lua file has the same structure.

--[[
BY CrimeM Š crimem.com
--]]

Config = {}

Config.ImgDirectory = 'ox_inventory/web/images/'
Config.Locale = 'en'
Config.Cooldown = 60 * 60 * 1 -- Cooldown in seconds
Config.AlwaysLocked = false    -- If true, the doors will be locked all the time, otherwise only when the robbery started
Config.ThermiteTime = 5000 -- Time in ms to burn the door after all animations are done
Config.C4Time = 5000 -- Time in ms to detonate the C4 after placement animations are done

Config.MinimumCops = {        -- Minimum amount of cops required to start the robbery
    jobs = { 'police', },
    amount = 1,
}

Config.Start = {
    door = {
        model = -8873588,
        coords = vector3(18.572002, -1115.495117, 29.946938),
    },
    requiredItems = { -- Required items to start the robbery, when remove = true, the item(s) will be removed when the robbery starts
        { item = 'WEAPON_ASSAULTRIFLE', label = 'Assault Rifle', amount = 1, remove = false },
        { item = 'safe_cracker',       label = 'Safe Cracker', amount = 1, remove = false },
        { item = 'glass_cutter',       label = 'Glass Cutter', amount = 1, remove = false },
        { item = 'c4_bomb',       label = 'C4 Bomb', amount = 2, remove = false },
        { item = 'thermite_bomb',       label = 'Thermite Bomb', amount = 2, remove = false },
        { item = 'drill',       label = 'Drill', amount = 1, remove = false },
        { item = 'usb_stick',       label = 'USB Stick', amount = 1, remove = false },
    },
}

Config.Robbery = {
    -- Loot under here is started when the robbery is started, we recommend putting the loot in the doors below, to prevent hackers to exploit.
    -- Unless there is no specific door for the loot, the loot will be set in here
    startLoot = {
        lockers = {
            {
                coords = vector3(24.61, -1086.587, 28.825),
                rotation = vector3(0.0, 0.0, 70.0),
                requiredItems = {
                    { item = 'drill', label = 'Drill', amount = 1, remove = false },
                },
                rewards = {
                    -- money = { type = 'bank', min = 0, max = 5000 },
                    items = {
                        { item = 'ammo_box_green', label = 'Green Ammo Box', min = 0, max = 2 },
                        { item = 'ammo_box_white', label = 'White Ammo Box', min = 0, max = 2 },
                    }
                }
            },
            {
                coords = vector3(25.105, -1085.224, 28.78),
                rotation = vector3(0.0, 0.0, 70.0),
                requiredItems = {
                    { item = 'drill', label = 'Drill', amount = 1, remove = false },
                },
                rewards = {
                    -- money = { type = 'bank', min = 0, max = 5000 },
                    items = {
                        { item = 'ammo_box_green', label = 'Green Ammo Box', min = 0, max = 2 },
                        { item = 'ammo_box_white', label = 'White Ammo Box', min = 0, max = 2 },
                    }
                }
            },
            {
                coords = vector3(25.633, -1083.776, 28.824),
                rotation = vector3(0.0, 0.0, 70.0),
                requiredItems = {
                    { item = 'drill', label = 'Drill', amount = 1, remove = false },
                },
                rewards = {
                    -- money = { type = 'bank', min = 0, max = 5000 },
                    items = {
                        { item = 'ammo_box_green', label = 'Green Ammo Box', min = 0, max = 2 },
                        { item = 'ammo_box_white', label = 'White Ammo Box', min = 0, max = 2 },
                    }
                }
            },
            {
                coords = vector3(26.123, -1082.428, 28.814),
                rotation = vector3(0.0, 0.0, 70.0),
                requiredItems = {
                    { item = 'drill', label = 'Drill', amount = 1, remove = false },
                },
                rewards = {
                    -- money = { type = 'bank', min = 0, max = 5000 },
                    items = {
                        { item = 'ammo_box_green', label = 'Green Ammo Box', min = 0, max = 2 },
                        { item = 'ammo_box_white', label = 'White Ammo Box', min = 0, max = 2 },
                    }
                }
            },
        },
        displays = {
            {
                glassCoords = vector3(10.9879, -1093.1768, 32.2521), -- Coords for the glass
                glassHeading = 254.6169,                             -- Heading for the glass
                valuables = {
                    {
                        model = 'w_sb_microsmg_las',
                        heading = 340.06,
                        displayRotation = vector3(360.0, 0.0, 180.0),
                        rewards = {
                            items = {
                                { item = 'weed_smg', label = 'Weed SMG', min = 1, max = 1 },
                            }
                        },
                    },
                },
                requiredItems = {
                    { item = 'glass_cutter', label = 'Glass Cutter', amount = 1, remove = false },
                },
            },
        },
        safes = {
            {
                coords = vector3(27.7786, -1078.8737, 26.7232),
                heading = 67.0,
                grabModel = 'w_pi_wep1_gun',
                requiredItems = {
                    { item = 'safe_cracker', label = 'Safe Cracker', amount = 1, remove = false },
                },
                rewards = {
                    -- money = { type = 'bank', min = 0, max = 5000 },
                    items = {
                        { item = 'golden_revolver', label = 'Golden Revolver', min = 1, max = 1 },
                    }
                }
            },
            {
                coords = vector3(29.0199, -1075.1704, 26.7232),
                heading = 70.2136,
                grabModel = 'w_sb_microsmg_luxe',
                requiredItems = {
                    { item = 'safe_cracker', label = 'Safe Cracker', amount = 1, remove = false },
                },
                rewards = {
                    -- money = { type = 'bank', min = 0, max = 5000 },
                    items = {
                        { item = 'golden_smg', label = 'Golden SMG', min = 1, max = 1 },
                    }
                }
            },
        },
        smashes = {
            {
                coords = vector3(11.152, -1104.51, 29.108),
                requiredItems = {
                    { item = 'WEAPON_ASSAULTRIFLE', label = 'Assault Rifle', amount = 1, remove = false },
                },
                rewards = {
                    -- money = { type = 'bank', min = 0, max = 5000 },
                    items = {
                        { item = 'ammo_box_green', label = 'Green Ammo Box', min = 0, max = 2 },
                        { item = 'ammo_box_white', label = 'White Ammo Box', min = 0, max = 2 },
                    }
                },
                scene = {
                    coords = vector3(10.5281, -1104.6962, 28.1173),
                    rotation = vector3(0.0, 0.0, -64.0),
                }
            },
            {
                coords = vector3(13.456, -1106.08, 29.103),
                requiredItems = {
                    { item = 'WEAPON_ASSAULTRIFLE', label = 'Assault Rifle', amount = 1, remove = false },
                },
                rewards = {
                    -- money = { type = 'bank', min = 0, max = 5000 },
                    items = {
                        { item = 'ammo_box_green', label = 'Green Ammo Box', min = 0, max = 2 },
                        { item = 'ammo_box_white', label = 'White Ammo Box', min = 0, max = 2 },
                    }
                },
                scene = {
                    coords = vector3(13.1168, -1106.7089, 28.1175),
                    rotation = vector3(0.0, 0.0, -19.0),
                }
            },
            {
                coords = vector3(9.538, -1109.006, 29.108),
                requiredItems = {
                    { item = 'WEAPON_ASSAULTRIFLE', label = 'Assault Rifle', amount = 1, remove = false },
                },
                rewards = {
                    -- money = { type = 'bank', min = 0, max = 5000 },
                    items = {
                        { item = 'ammo_box_green', label = 'Green Ammo Box', min = 0, max = 2 },
                        { item = 'ammo_box_white', label = 'White Ammo Box', min = 0, max = 2 },
                    }
                },
                scene = {
                    coords = vector3(10.0783, -1108.7725, 28.1126),
                    rotation = vector3(0.0, 0.0, 117.0),
                }
            },
            {
                coords = vector3(5.912, -1105.807, 29.114),
                requiredItems = {
                    { item = 'WEAPON_ASSAULTRIFLE', label = 'Assault Rifle', amount = 1, remove = false },
                },
                rewards = {
                    -- money = { type = 'bank', min = 0, max = 5000 },
                    items = {
                        { item = 'ammo_box_green', label = 'Green Ammo Box', min = 0, max = 2 },
                        { item = 'ammo_box_white', label = 'White Ammo Box', min = 0, max = 2 },
                    }
                },
                scene = {
                    coords = vector3(6.5589, -1106.1060, 28.1175),
                    rotation = vector3(0.0, 0.0, 66.0),
                }
            },
        },
    },
    -- Loot is mostly setupped within the doors below, so it spawns when a door has been opened, in order to prevent hackers from exploiting.
    entranceDoors = {
        leftDoor = {
            action = 'c4',
            requiredItems = {
                { item = 'c4_bomb', label = 'C4 Bomb', amount = 1, remove = true },
            },
            scene = { -- Scene settings are required for c4
                coords = vector3(17.1008, -1115.1327, 29.7913),
                rotation = vector3(0.0, 0.0, -16.0),
            }
        },
        rightDoor = {
            action = 'c4',
            requiredItems = {
                { item = 'c4_bomb', label = 'C4 Bomb', amount = 1, remove = true },
            },
            scene = { -- Scene settings are required for c4
                coords = vector3(17.4586, -1115.2438, 29.7949),
                rotation = vector3(0.0, 0.0, -17.0),
            }
        },
    },
    storageDoors = {
        entranceDoor = {
            action = 'usb',
            requiredItems = {
                { item = 'usb_stick', label = 'USB Stick', amount = 1, remove = false },
            },
        },
        leftDoor = {
            action = 'thermite',
            requiredItems = {
                { item = 'thermite_bomb', label = 'Thermite Bomb', amount = 1, remove = true },
            },
            scene = { -- Scene settings are required for thermite
                coords = vector3(29.6750, -1083.7168, 27.7232),
                rotation = vector3(0.0, 0.0, 72.0),
            }
        },
        forwardDoor = {
            action = 'thermite',
            requiredItems = {
                { item = 'thermite_bomb', label = 'Thermite Bomb', amount = 1, remove = true },
            },
            scene = { -- Scene settings are required for thermite
                coords = vector3(32.1202, -1082.8671, 27.7232),
                rotation = vector3(0.0, 0.0, -20.0),
            }
        },
    },
    officeDoors = {
        leftDoor = {
            action = 'c4',
            requiredItems = {
                { item = 'c4_bomb', label = 'C4 Bomb', amount = 1, remove = true },
            },
            scene = { -- Scene settings are required for c4
                coords = vector3(9.0117, -1094.7972, 33.2521),
                rotation = vector3(0.0, 0.0, -23.0),
            }
        },
        rightDoor = {
            action = 'c4',
            requiredItems = {
                { item = 'c4_bomb', label = 'C4 Bomb', amount = 1, remove = true },
            },
            scene = { -- Scene settings are required for c4
                coords = vector3(16.9150, -1089.9240, 33.2522),
                rotation = vector3(0.0, 0.0, 66.0),
            }
        },
    },
    laserZones = { -- Uses mka_lasers
        {
            deactivate = vector3(21.772, -1094.294, 33.151),
            lasers = { -- Only change these lasers if you have experience setting it up with mka_lasers
                {
                    vector3(20.013, -1115.124, 35.286),
                    {vector3(2.735, -1109.362, 28.109), vector3(6.411, -1098.456, 28.095), vector3(24.292, -1105.432, 29.012), vector3(20.642, -1115.224, 28.801), vector3(15.188, -1113.779, 28.801)},
                    {travelTimeBetweenTargets = {1.0, 1.0}, waitTimeAtTargets = {0.0, 0.0}, randomTargetSelection = false, name = "laser1"}
                },
                {
                    vector3(24.457, -1104.866, 35.382),
                    {vector3(9.879, -1111.792, 28.118), vector3(10.535, -1110.027, 28.118), vector3(9.417, -1107.473, 28.095), vector3(6.441, -1106.39, 28.095), vector3(7.709, -1103.311, 28.095), vector3(7.64, -1102.02, 28.105), vector3(5.312, -1101.177, 28.118), vector3(2.74, -1108.98, 28.199)},
                    {travelTimeBetweenTargets = {1.0, 1.0}, waitTimeAtTargets = {0.0, 0.0}, randomTargetSelection = false, name = "laser2"}
                },
                {
                    vector3(2.619, -1108.795, 35.462),
                    {vector3(11.179, -1100.303, 28.109), vector3(10.054, -1103.474, 28.109), vector3(11.125, -1105.984, 28.095), vector3(15.31, -1107.515, 28.109), vector3(18.329, -1106.374, 28.095), vector3(19.499, -1103.22, 28.172), vector3(17.413, -1104.109, 28.109), vector3(16.851, -1105.753, 28.109), vector3(16.011, -1106.178, 28.109), vector3(11.848, -1104.638, 28.109), vector3(11.61, -1103.713, 28.109), vector3(12.051, -1101.996, 28.109)},
                    {travelTimeBetweenTargets = {1.0, 1.0}, waitTimeAtTargets = {0.0, 0.0}, randomTargetSelection = false, name = "laser3"}
                },
            }
        },
        {
            deactivate = vector3(11.937, -1093.894, 33.057),
            lasers = { -- Only change these lasers if you have experience setting it up with mka_lasers
                {
                    {vector3(10.876, -1088.228, 35.053), vector3(15.912, -1090.109, 35.053), vector3(13.867, -1095.207, 34.979), vector3(8.974, -1093.643, 35.072)},
                    {vector3(10.979, -1088.5, 32.851), vector3(15.788, -1090.068, 32.252), vector3(13.785, -1095.387, 32.252), vector3(8.903, -1093.633, 32.252)},
                    {travelTimeBetweenTargets = {1.0, 1.0}, waitTimeAtTargets = {0.0, 0.0}, name = "laser4"}
                },
                {
                    {vector3(11.299, -1089.296, 34.926), vector3(13.421, -1090.062, 34.926), vector3(12.57, -1092.21, 34.926), vector3(10.479, -1091.452, 34.926)},
                    {vector3(11.227, -1089.125, 32.252), vector3(13.532, -1089.955, 32.252), vector3(12.34, -1091.931, 32.252), vector3(10.611, -1091.195, 32.252)},
                    {travelTimeBetweenTargets = {1.0, 1.0}, waitTimeAtTargets = {0.0, 0.0}, name = "laser5"}
                },
            }
        },
        {
            deactivate = vector3(33.695, -1080.765, 28.397),
            lasers = { -- Only change these lasers if you have experience setting it up with mka_lasers
                {
                    {vector3(32.201, -1081.379, 29.283), vector3(32.803, -1079.725, 29.283)},
                    {vector3(32.038, -1081.503, 26.723), vector3(32.704, -1079.719, 26.723)},
                    {travelTimeBetweenTargets = {1.0, 1.0}, waitTimeAtTargets = {0.0, 0.0}, name = "laser6"}
                },
                {
                    {vector3(33.368, -1078.17, 29.283), vector3(33.967, -1076.518, 29.283)},
                    {vector3(33.158, -1078.337, 26.723), vector3(33.836, -1076.586, 26.723)},
                    {travelTimeBetweenTargets = {1.0, 1.0}, waitTimeAtTargets = {0.0, 0.0}, name = "laser7"}
                },
                {
                    {vector3(28.405, -1080.061, 29.283), vector3(29.018, -1078.403, 29.283)},
                    {vector3(28.443, -1080.007, 26.723), vector3(29.042, -1078.549, 26.796)},
                    {travelTimeBetweenTargets = {1.0, 1.0}, waitTimeAtTargets = {0.0, 0.0}, name = "laser8"}
                },
                {
                    {vector3(29.882, -1076.873, 29.283), vector3(30.51, -1075.214, 29.283)},
                    {vector3(29.872, -1077.336, 26.723), vector3(30.522, -1074.957, 26.723)},
                    {travelTimeBetweenTargets = {1.0, 1.0}, waitTimeAtTargets = {0.0, 0.0}, name = "laser9"}
                },
            }
        },
    },
    cameras = { -- Viewable cameras when the robbery is started
        enabled = true,
        open = {
            everyone = false, -- If true, everyone can view the cameras, otherwise only the jobs below
            jobs = { 'police', },
            coords = vector3(-3.1116, -1080.7548, 27.0721),
            rotation = vector3(0.0, 0.0, -22.0),
        },
        cams = {
            { x = 3.1502442359924, y = -1108.6370849609, z = 33.466042327881, r = { x = -35.0, y = -0.0, z = -61.020648956299 } },
            { x = 25.620136260986, y = -1090.083984375, z = 35.009102630615, r = { x = -35.0, y = -0.0, z = 170.43585205078 } },
            { x = 19.86371421814, y = -1114.5321044922, z = 34.058476257324, r = { x = -35.0, y = 0.0, z = 6.6563482284546 } },
            { x = 28.02232170105, y = -1088.7780761719, z = 30.109286117554, r = { x = -35.0, y = -0.0, z = -41.336044311523 } },
            { x = 32.802352905273, y = -1082.7043457031, z = 29.81416015625, r = { x = -35.0, y = 0.0, z = 19.530124664307 } },
            { x = 10.601628303528, y = -1087.3801269531, z = 35.234669494629, r = { x = -35.0, y = -0.0, z = -151.13514709473 } },
        }
    }
}

Config.End = {
    death = { -- End robbery if player dies
        enabled = true
    },
    distance = { -- End robbery if player goes out of distance
        enabled = true,
        radius = 150.0 -- Out of distance radius
    },
    timer = { -- End robbery if timer runs out
        enabled = true,
        seconds = 600,
        show = true, -- Show timer to the robber
    }
}

Config.Selling = {
    enabled = true,
    coords = vector3(12.4430, 3734.0833, 38.9876),
    npcModel = 'u_m_m_aldinapoli',
    heading = 237.0536,
    moneyType = 'bank',
    items = { -- Items that can be sold
        ['golden_smg'] = { label = 'Golden SMG', price = 50000 }, -- Price is per 1
        ['golden_revolver'] = { label = 'Golden Revolve', price = 35000 },
        ['weed_smg'] = { label = 'Weed SMG', price = 25000 },
        ['ammo_box_green'] = { label = 'Green Ammo Box', price = 250 },
        ['ammo_box_white'] = { label = 'White Ammo Box', price = 100 },
    }
}

Config.CopsNotifications = {
    jobs = { 'police', },
    onRobbertyStart = 'Ammunation is being robbed! Hurry!', -- put to false to disable (onRobbertyStart = false,)
}

--[[
    ONLY CHANGE THIS PART IF YOU HAVE RENAMED SCRIPTS SUCH AS FRAMEWORK, TARGET, INVENTORY ETC
    RENAME THE SCRIPT NAME TO THE NEW NAME
--]]
---@type table Only change these if you have changed the name of a resource
Resources = {
    FM = { name = 'fmLib', export = 'new' },
    OXTarget = { name = 'ox_target', export = 'all' },
    QBTarget = { name = 'qb-target', export = 'all' },
    MKALasers = { name = 'mka-lasers', export = false },
}
IgnoreScriptFoundLogs = false

Opensource Code

--[[
BY CrimeM Š crimem.com
--]]

function InitStartDoorTarget(obj)
    if OXTarget then
        OXTarget:addLocalEntity(obj, {
            {
                name = 'startRobbery', -- Do not change the name
                label = 'Start Robbery',
                icon = 'fas fa-gun',
                distance = 2.5,
                canInteract = function()
                    return GlobalState[State.ROBBERYSTATUS] == Status.NOTSTARTED
                end,
                onSelect = function()
                    TriggerServerEvent(_E('startRobbery'))
                end
            }
        })

        TargetEntities[obj] = 'startRobbery'
    elseif QBTarget then
        QBTarget:AddTargetEntity(obj, {
            options = {
                {
                    label = 'Start Robbery',
                    icon = 'fas fa-gun',
                    targeticon = 'fas fa-gun',
                    action = function()
                        TriggerServerEvent(_E('startRobbery'))
                    end,
                    canInteract = function()
                        return GlobalState[State.ROBBERYSTATUS] == Status.NOTSTARTED
                    end,
                },
            },
            distance = 2.5,
        })

        TargetEntities[obj] = 'Start Robbery'
    end
end

function InitSellingTarget(npc)
    if OXTarget then
        OXTarget:addLocalEntity(npc, {
            {
                label = 'Sell Loot',
                icon = 'fas fa-dollar-sign',
                distance = 2.5,
                onSelect = function()
                    OpenSellingNPC()
                end
            }
        })
    elseif QBTarget then
        QBTarget:AddTargetEntity(npc, {
            options = {
                {
                    label = 'Sell Loot',
                    icon = 'fas fa-dollar-sign',
                    targeticon = 'fas fa-dollar-sign',
                    action = function()
                        OpenSellingNPC()
                    end,
                },
            },
            distance = 2.5,
        })
    end
end

function InitLaserDeactivationTarget(lZoneKey) 
    local zone = LaserZones[lZoneKey]
    if not zone then Error('Laser zone not found with key: ' .. lZoneKey) return end

    if OXTarget then
        TargetZones[#TargetZones+1] = OXTarget:addSphereZone({
            coords = zone.deactivate,
            radius = 0.8,
            debug = false,
            drawSprite = true,
            options = {
                {
                    label = 'Deactivate Lasers',
                    icon = 'fas fa-power-off',
                    distance = 2.5,
                    canInteract = function()
                        return not DoingAction and not zone.deactivated
                    end,
                    onSelect = function()
                        DoingAction = true

                        if DisableLasersMinigame() then                 
                            TriggerServerEvent(_E('server:deactivateLaserZone'), lZoneKey)
                        end

                        DoingAction = false
                    end
                }
            }
        })
    elseif QBTarget then
        local name = 'laser_deactivation'
        TargetZones[#TargetZones+1] = name
        QBTarget:AddCircleZone(name, zone.deactivate, 1.0, {
            name = name,
            debugPoly = false,
        }, {
            options = {
                {
                    label = 'Deactivate Lasers',
                    icon = 'fas fa-power-off',
                    targeticon = 'fas fa-power-off',
                    action = function()
                        DoingAction = true

                        if DisableLasersMinigame() then                      
                            TriggerServerEvent(_E('server:deactivateLaserZone'), lZoneKey)
                        end

                        DoingAction = false
                    end,
                    canInteract = function()
                        return not DoingAction and not zone.deactivated
                    end
                }
            },
            distance = 2.5,
        })
    end
end

function InitOpenCamerasTarget()
    local openCam = Config.Robbery.cameras.open

    if OXTarget then
        TargetZones[#TargetZones+1] = OXTarget:addSphereZone({
            coords = openCam.coords,
            radius = 1.0,
            debug = false,
            drawSprite = true,
            options = {
                {
                    label = 'View Cameras',
                    icon = 'fas fa-video',
                    distance = 2.5,
                    canInteract = function()
                        return not DoingAction
                    end,
                    onSelect = function()
                        OpenCameras()
                    end
                }
            }
        })
    elseif QBTarget then
        local name = 'open_cameras'
        TargetZones[#TargetZones+1] = name
        QBTarget:AddCircleZone(name, openCam.coords, 1.0, {
            name = name,
            debugPoly = false,
        }, {
            options = {
                {
                    label = 'View Cameras',
                    icon = 'fas fa-video',
                    targeticon = 'fas fa-video',
                    action = function()
                        OpenCameras()
                    end,
                    canInteract = function()
                        return not DoingAction
                    end
                }
            },
            distance = 2.5,
        })
    end
end

function InitLockedDoorTarget(obj, i, label, icon)
    local door = Doors[i]
    if not door then Error('Door not found with index: ' .. i) return end

    if OXTarget then
        OXTarget:addLocalEntity(obj, {
            {
                name = 'door', -- Do not change the name
                label = label,
                icon = icon,
                distance = 2.5,
                canInteract = function()
                    return InRobbery and not DoingAction and not Doors[i].opened
                end,
                onSelect = function()
                    OpenDoor(i)
                end
            }
        })

        TargetEntities[obj] = 'door'
    elseif QBTarget then
        QBTarget:AddTargetEntity(obj, {
            options = {
                {
                    label = label,
                    icon = icon,
                    targeticon = icon,
                    action = function()
                        OpenDoor(i)
                    end,
                    canInteract = function()
                        return InRobbery and not DoingAction and not Doors[i].opened
                    end,
                },
            },
            distance = 2.5,
        })

        TargetEntities[obj] = label
    end
end

---@param type 'trollies' | 'stacks' | 'paintings' | 'displays' | 'lockers' | 'safes' | 'smashes'
function InitLootTarget(type, obj, i, label)
    local loot = GetLootByTypeAndIndex(type, i)

    if OXTarget then
        local options = {
            {
                name = type, -- Do not change the name
                label = label,
                icon = 'fas fa-hand',
                distance = 2.5,
                canInteract = function()
                    return not DoingAction and not loot.taken
                end,
                onSelect = function()
                    GrabLoot(type, i)
                end
            }
        }
    
        if type == 'stacks' or type == 'lockers' or type == 'smashes' then
            TargetZones[#TargetZones+1] = OXTarget:addSphereZone({
                coords = loot.coords,
                radius = type == 'stacks' and 0.5 or 0.2,
                debug = false,
                drawSprite = true,
                options = options
            })
        elseif obj then
            OXTarget:addLocalEntity(obj, options)
            TargetEntities[obj] = type
        end
    elseif QBTarget then
        local options = {
            {
                label = label,
                icon = 'fas fa-hand',
                targeticon = 'fas fa-hand',
                action = function()
                    GrabLoot(type, i)
                end,
                canInteract = function()
                    return not DoingAction and not loot.taken
                end
            }
        }
        
        if type == 'stacks' or type == 'lockers' then
            local name = type..tostring(i)
            TargetZones[#TargetZones+1] = name
            QBTarget:AddCircleZone(name, loot.coords, type == 'stacks' and 0.5 or 0.2, {
                name = name,
                debugPoly = false,
            }, {
                options = options,
                distance = 2.5,
            })
        else
            QBTarget:AddTargetEntity(obj, {
                options = options,
                distance = 2.5,
            })
            TargetEntities[obj] = label
        end
    end
end

-- must return true or false
function DisableLasersMinigame()
    if GetResourceState('utk_fingerprint') ~= 'started' or GetResourceState('utk_hackdependency') ~= 'started' then
        return MinigameNotFoundFallback({ 'utk_fingerprint', 'utk_hackdependency' })
    end

    local res = promise.new()

    TriggerEvent("utk_fingerprint:Start", 2, 4, 2, function(outcome, reason)
        res:resolve(outcome)
    end)

    return Citizen.Await(res)
end

-- must return true or false
function USBHackMinigame()
    if GetResourceState('ultra-keypackhack') ~= 'started' then
        return MinigameNotFoundFallback({ 'ultra-keypackhack' })
    end

    local res = promise.new()

    TriggerEvent('ultra-keypadhack', 6, 120, function(outcome, reason)
        if outcome == 1 then
            res:resolve(true)
        else
            res:resolve(false)
        end
	end)

    return Citizen.Await(res)
end

-- must return true or false
function LaptopHackMinigame()
    if GetResourceState('ultra-keypackhack') ~= 'started' then
        return MinigameNotFoundFallback({ 'ultra-keypackhack' })
    end

    local res = promise.new()

    TriggerEvent('ultra-keypadhack', 6, 120, function(outcome, reason)
        if outcome == 1 then
            res:resolve(true)
        else
            res:resolve(false)
        end
	end)

    return Citizen.Await(res)
end

-- must return true or false
function DrillingMinigame()
    if GetResourceState('fivem-drilling') ~= 'started' or GetResourceState('meta_libs') ~= 'started' then
        return MinigameNotFoundFallback({ 'fivem-drilling', 'meta_libs' })
    end

    local res = promise.new()

    TriggerEvent("Drilling:Start",function(success)
        res:resolve(success)
    end)

    return Citizen.Await(res)
end

-- must return true or false
function CrackSafeMinigame()
    if GetResourceState('ox_lib') ~= 'started' then
        return MinigameNotFoundFallback({ 'ox_lib' })
    end

    local difficulties = {
        'easy',
        'medium',
        -- 'hard',
    }

    return lib.skillCheck(difficulties, {'w', 'a', 's', 'd'})
end

-- must return true or false
function SmashGlassMinigame()
    if GetResourceState('ox_lib') ~= 'started' then
        return MinigameNotFoundFallback({ 'ox_lib' })
    end

    local difficulties = {
        'easy',
        'medium',
        -- 'hard',
    }

    return lib.skillCheck(difficulties, {'w', 'a', 's', 'd'})
end

function OnPlayerLaserHit(playerBeingHit, hitPos)
    if playerBeingHit then
        StartScreenEffect('DeathFailNeutralIn', 0, false)
        ApplyDamageToPed(PlayerPedId(), 20, true)
    else
        StopScreenEffect('DeathFailNeutralIn')
    end
end

RegisterNetEvent(_E('notifyCops'), function(coords, msg)
    local blip = AddBlipForCoord(coords.x, coords.y, coords.z)
    SetBlipSprite(blip, 161)
    SetBlipScale(blip, 1.0)
    SetBlipColour(blip, 1)
    SetBlipAsShortRange(blip, false)
    BeginTextCommandSetBlipName("STRING")
    AddTextComponentString('Suspicious activity')
    EndTextCommandSetBlipName(blip)

    FM.utils.notify(msg, 'error')

    Wait(20000)
    RemoveBlip(blip)
end)

Last updated