Full View config.robbery.lua

Preview File Updated: v1.0.7 - 12.05.2024

-- β–ˆβ–€β–„ β–„β–€β–„ β–ˆβ–ˆβ–„ β–ˆβ–ˆβ–„ β–ˆβ–ˆβ–€ β–ˆβ–€β–„ β–ˆ β–ˆβ–ˆβ–€ β–„β–€β–€
-- β–ˆβ–€β–„ β–€β–„β–€ β–ˆβ–„β–ˆ β–ˆβ–„β–ˆ β–ˆβ–„β–„ β–ˆβ–€β–„ β–ˆ β–ˆβ–„β–„ β–„β–ˆβ–ˆ

Config.UseRobbery = true

-- @RobberiesAbility: Configure stores for robbery opportunities
Config.RobberiesAbility = {
    ['server'] = true, -- Stores not owned by players, server stores
    ['owned'] = true -- Stores owned by players
}

-- @PoliceJobs: Name of service jobs, if you have more than one job e.g. 'police' and 'sheriff' you can use the table {'police', 'sheriff'}, the values will add up 
Config.PoliceJobs = {'police', 'mechanic'}

-- @PoliceJobs: Required number of online police officers to start a robbery
Config.RequiredPolices = 2

-- @DisableAbilityPurchaseOnRobbery: Once the robbery begins, it will not be possible to purchase products from this store.
Config.DisableAbilityPurchaseOnRobbery = true

-- @AbilityPurchaseTimeAfterRobbery: Time after robbery when the store will be active again given in milliseconds (default 30 minutes)
Config.AbilityPurchaseTimeAfterRobbery = 15 * 60 * 1000

-- @AbilityRobItems: When robbing a safe, does the player have the opportunity to get items
Config.AbilityRobItems = false
Config.RobberyItems = {
    {name = 'bread', count = {1, 6}, chances = 80}, -- item: bread, count random from 1 to 6, 80% chances to get that
}

-- @RobberyMoneyType: 'cash' / 'bank' / 'dirty'
Config.RobberyMoneyType = 'dirty'

-- @RobMoneyFromBalance: When robbing, is the money to be obtained from the safe balance from the store or is it to be generated by the server?
Config.RobMoneyFromBalance = true

-- @RobberyMoney: Used only if you don't use Config.RobMoneyFromBalance or store is not owned (Can be used as a number, e.g. 2500 and a table to randomize the amount {1500, 2500})
Config.RobberyMoney = {1500, 2000}

-- @RobberyMoneyFromBags: Random amount of money that cashiers intimidated by the player will pack (server-spawned money, does not take from the store's safe)
Config.RobberyMoneyFromBags = {250, 450}

-- @RobberyMoneyPercentage: What percentage of the robbery is to be taken from the balance of the store's safe and given to the robber
Config.RobberyMoneyPercentage = 50

-- @RobberyMoneyPercentageWithInsurance: What percentage of the robbery is to be taken from the balance of the store's safe when it has insurance and given to the robber
Config.RobberyMoneyPercentageWithInsurance = 20

-- @RobberyReturnMoneyWithInsurance: What percentage of the stolen amount is to be refunded when the store has purchased insurance
Config.RobberyReturnMoneyWithInsurance = 75

-- @IntimidationPeds:
Config.IntimidationPeds = {
    timeout = 1000, -- Every what time is to be refreshed checking if the player performs any of the following actions (miliseconds) - the higher the value, the longer the robbery will take.
    actions = {
        ['shoot'] = {355, 655}, -- The range of values to be added when a player shoots in the store. (The value is divided by 10, if you enter {3, 6}, 0.3 - 0.6 will be added)
        ['aimingOnPed'] = {7, 10}, -- The range of values to be added when a player aiming on the peds. (The value is divided by 10, if you enter {7, 10}, 0.7 - 1.0 will be added)
    }
}


-- @RobberyPossibleTime: The time in the game in which players can make a heist, for example if you don't want them to make heists during the day, you can use the following option using hours in hourRange from 0 to 7, then only from this hour to this hour players will be able to make a heist.
Config.RobberyPossibleTime = {
    -- For exmple from 00:00 to 06:00
    use = false,
    hourRange = {0, 6}
}

-- @SafeRobberyGame: 
Config.SafeRobberyGame = function(onSuccess, onFailed)
    local finished = exports["tgiann-skillbar"]:taskBar(200)
    if finished then
        local finished2 = exports["tgiann-skillbar"]:taskBar(50)
        if finished2 then
            onSuccess()
        else
            onFailed()
        end
    else
        onFailed()
    end
end

-- @RobberyOnAlarm: In this function you can put an event to your dispatch when a player starts robbing a store
Config.RobberyOnAlarm = function(storeData, storeId)
    if GetResourceState('qs-dispatch') ~= 'missing' then
        TriggerServerEvent('qs-dispatch:server:CreateDispatchCall', {
            job = {'police', 'sheriff'},
            callLocation = vector3(storeData.managementPoint.coords.x, storeData.managementPoint.coords.y, storeData.managementPoint.coords.z),
            callCode = {code = '??-??', snippet = '<CALL SNIPPED EX: 10-10>'},
            message = ("The %s store alarm at %s has just been triggered."):format(storeData.brand, storeData.address),
            flashes = false, -- you can set to true if you need call flashing sirens...
            blip = {
                sprite = 488, -- blip sprite
                scale = 1.5, -- blip scale
                colour = 1, -- blio colour
                flashes = true, -- blip flashes
                text = 'Store Robbery', -- blip text
                time = (20 * 1000), --blip fadeout time (1 * 60000) = 1 minute
            },
            otherData = {
                {
                    text = 'Red Obscure', -- text of the other data item (can add more than one)
                    icon = 'fas fa-user-secret', -- icon font awesome https://fontawesome.com/icons/
                }
            }
        })
    elseif GetResourceState('core_dispatch') ~= 'missing' then
        TriggerServerEvent("core_dispatch:addCall",
            "10-71",
            "Store Robbery",
            {{icon = "fa-venus-mars", info = "male"}},
            {storeData.managementPoint.coords.x, storeData.managementPoint.coords.y, storeData.managementPoint.coords.z},
            "police",
            5000,
            156,
            1
        )
    else
        TriggerServerEvent("vms_stores:policeNotify", {
            job = {'police', 'sheriff'},
            message = ("The %s store alarm at %s has just been triggered."):format(storeData.brand, storeData.address),
            storeId = storeId,
            brand = storeData.brand,
            address = storeData.address,
            coords = vector3(storeData.managementPoint.coords.x, storeData.managementPoint.coords.y, storeData.managementPoint.coords.z),
            blip = {
                sprite = 431,
                scale = 1.3,
                color = 1,
                text = 'Store Robbery',
                time = (60 * 1000),
                radius = true,
            },
        })
    end
end

-- @DestroyCamerasAbility: Setting true will allow robbers to destroy the cameras which will result in the alarm not being triggered and the police not being notified of the robbery taking place
Config.DestroyCamerasAbility = true

-- @DestroyedCamerasTime: Time after which the cameras will work again
Config.DestroyedCamerasTime = 5 * 60 * 1000

-- @DestoryCamerasRequiredItem: You can set the required item to destroy cameras
Config.DestoryCamerasRequiredItem = "hack_phone" -- if you don't want required item, set it as nil
Config.DestoryCamerasRequiredItemCount = 1
Config.DestoryCamerasRemoveItemOnUse = true

-- @DestoryCamerasGame: Camera destroy mini-game, you can plug in your custom game.
Config.DestoryCamerasGame = function(onSuccess, onFailed)
    local finished = exports["tgiann-skillbar"]:taskBar(200)
    if finished then
        local finished2 = exports["tgiann-skillbar"]:taskBar(50)
        if finished2 then
            onSuccess()
        else
            onFailed()
        end
    else
        onFailed()
    end
end

Last updated