config.lua

Full View

Config = {}

Config.Framework = 'esx' -- Options: 'esx' or 'qbcore'
Config.NotificationSystem = 'ox_lib'  -- Notification system: 'ox_lib', 'tnotify', 'okoknotify', 'print', 'framework'

Config.Crates = {
    ammobox1 = { -- crate
        itemName = 'ammobox1', -- required crate item
        requireItem = nil, -- required item in inventory to attempt (e.g. lockpick)
        LockpickBreakChance = 0.5,  -- 50% chance to break on failed skill check
        SoftlockAttempts = 2,       -- crate disappears after 2 failed attempts
        allowedZones = {}, -- coordinates and radius where crate can be opened Example: mystery crate
        timedWindows = {}, -- time windows when crate can be opened Example: timed crate
        alertJob = nil, -- if crate is opened successfully, this job gets notified with location Example: common_event crate
        skillCheck = {
            EnableSkillCheck = false, -- true = skillcheck, false = progress bar
            ProcessTime = 3, -- process bar time in seconds
            SkillCheckDifficulty = { 'easy', 'easy' }, -- difficulties: easy, medium, hard
            SkillCheckKeys = { 'w', 'a', 's', 'd' }, -- keys used in skillcheck
            Anim = nil -- if not specified, uses DefaultAnim Example: common_event crate
        },
        loot = { -- loot rarity order: 'common', 'uncommon', 'rare', 'epic', 'legendary'
            common = {
                chance = 90, -- category chance %
                items = {
                    ['ammo-9'] = { min = 12, max = 12 }, -- item with min/max amount
                }
            },
            rare = {
                chance = 10,
                items = {
                    ['ammo-9'] = { min = 13, max = 16 }
                }
            },
        },
        rewardsMinMax = { minRewards = 1, maxRewards = 1 } -- how many rewards drop from crate
    },

    case_of_water = {
        itemName = 'case_of_water',
        requireItem = nil,
        LockpickBreakChance = 0.5,
        SoftlockAttempts = 5,
        allowedZones = {},
        timedWindows = {},
        alertJob = nil,
        skillCheck = {
            EnableSkillCheck = false,
            ProcessTime = 10,
            SkillCheckDifficulty = { 'easy', 'easy' },
            SkillCheckKeys = { 'w', 'a', 's', 'd' },
            Anim = nil
        },
        loot = {
            common = {
                chance = 100,
                items = {
                    ['water'] = { min = 6, max = 6 },
                }
            },
        },
        rewardsMinMax = { minRewards = 1, maxRewards = 1 }
    },

    basic = {
        itemName = 'basic',
        requireItem = nil,
        LockpickBreakChance = 0.5,
        SoftlockAttempts = 5,
        allowedZones = {},
        timedWindows = {},
        alertJob = nil,
        skillCheck = {
            EnableSkillCheck = true,
            ProcessTime = 10,
            SkillCheckDifficulty = { 'easy', 'easy' },
            SkillCheckKeys = { 'w', 'a', 's', 'd' },
            Anim = nil
        },
        loot = {
            common = {
                chance = 60,
                items = {
                    ['bread'] = { min = 1, max = 3 },
                    ['water'] = { min = 1, max = 2 },
                }
            },
            rare = {
                chance = 30,
                items = {
                    ['weapon_pistol'] = { min = 1, max = 1 }
                }
            },
            epic = {
                chance = 10,
                items = {
                    ['epic'] = { min = 1, max = 1 }
                }
            }
        },
        rewardsMinMax = { minRewards = 2, maxRewards = 3 }
    },

    common_event = {
        itemName = 'common_event',
        requireItem = nil,
        LockpickBreakChance = 0.5,
        SoftlockAttempts = 3,
        allowedZones = {},
        timedWindows = {},
        alertJob = 'mechanic',
        skillCheck = {
            EnableSkillCheck = true,
            ProcessTime = 10,
            SkillCheckDifficulty = { 'easy', 'easy', 'easy', 'easy' },
            SkillCheckKeys = { 'w', 'a', 's', 'd' },
            Anim = {
                dict = 'anim@heists@ornate_bank@hack',
                clip = 'hack_enter',
                flag = 49
            }            
        },
        loot = {
            common = {
                chance = 60,
                items = {
                    ['bread'] = { min = 1, max = 2 },
                    ['water'] = { min = 1, max = 2 },
                }
            },
            rare = {
                chance = 30,
                items = {
                    ['weapon_pistol'] = { min = 1, max = 1 }
                }
            },
            epic = {
                chance = 10,
                items = {
                    ['weapon_pumpshotgun'] = { min = 1, max = 1 }
                }
            }
        },
        rewardsMinMax = { minRewards = 1, maxRewards = 2 }
    },

    premium = {
        itemName = 'premium',
        requireItem = 'lockpick',
        LockpickBreakChance = 0.5,
        SoftlockAttempts = 5,
        allowedZones = {},
        timedWindows = {},
        alertJob = nil,
        skillCheck = {
            EnableSkillCheck = true,
            ProcessTime = 12,
            SkillCheckDifficulty = { 'easy', 'easy' }, -- 'easy', 'medium'
            SkillCheckKeys = { 'q', 'e' },
            Anim = nil
        },
        loot = {
            common = {
                chance = 50,
                items = {
                    ['bread'] = { min = 1, max = 2 },
                    ['water'] = { min = 1, max = 1 },
                }
            },
            rare = {
                chance = 35,
                items = {
                    ['weapon_pistol'] = { min = 1, max = 1 }
                }
            },
            epic = {
                chance = 15,
                items = {
                    ['epic'] = { min = 1, max = 1 }
                }
            }
        },
        rewardsMinMax = { minRewards = 2, maxRewards = 2 }
    },

    vip = {
        itemName = 'vip',
        requireItem = 'lockpick',
        LockpickBreakChance = 0.5,
        SoftlockAttempts = 10,
        allowedZones = {},
        timedWindows = {},
        alertJob = nil,
        skillCheck = {
            EnableSkillCheck = true,
            ProcessTime = 15,
            SkillCheckDifficulty = { 'easy', 'easy' }, -- 'hard', 'medium'
            SkillCheckKeys = { 'q', 'e' },
            Anim = nil
        },
        loot = {
            common = {
                chance = 40,
                items = {
                    ['bread'] = { min = 1, max = 2 },
                    ['water'] = { min = 1, max = 1 },
                }
            },
            rare = {
                chance = 40,
                items = {
                    ['weapon_pistol'] = { min = 1, max = 1 }
                }
            },
            epic = {
                chance = 20,
                items = {
                    ['weapon_pumpshotgun'] = { min = 1, max = 1 },
                    ['premium'] = { min = 1, max = 1 },
                }
            }
        },
        rewardsMinMax = { minRewards = 2, maxRewards = 3 }
    },

    mystery = {
        itemName = 'mystery',
        requireItem = nil,
        LockpickBreakChance = 0.5,
        SoftlockAttempts = 5,
        allowedZones = {
            { x = 1200.5154,  y = -3098.6687,  z = 5.8460, radius = 25.0 },
        },
        timedWindows = {},
        alertJob = nil,
        skillCheck = {
            EnableSkillCheck = true,
            ProcessTime = 12,
            SkillCheckDifficulty = { 'easy', 'easy' }, -- 'medium', 'easy'
            SkillCheckKeys = { 'w', 's', 'a', 'd' },
            Anim = nil
        },
        loot = {
            common = {
                chance = 50,
                items = {
                    ['bread'] = { min = 1, max = 2 }
                }
            },
            rare = {
                chance = 35,
                items = {
                    ['weapon_pistol'] = { min = 1, max = 1 }
                }
            },
            epic = {
                chance = 15,
                items = {
                    ['epic'] = { min = 1, max = 1 }
                }
            }
        },
        rewardsMinMax = { minRewards = 1, maxRewards = 2 }
    },

    timed = {
        itemName = 'timed',
        requireItem = nil,
        LockpickBreakChance = 0.5,
        SoftlockAttempts = 5,
        allowedZones = {},
        timedWindows = {
            { start = "08:00", finish = "20:00" },
        },
        alertJob = nil,
        skillCheck = {
            EnableSkillCheck = true,
            ProcessTime = 10,
            SkillCheckDifficulty = { 'easy', 'easy' },
            SkillCheckKeys = { 'w', 's' },
            Anim = nil
        },
        loot = {
            common = {
                chance = 60,
                items = {
                    ['bread'] = { min = 1, max = 2 },
                    ['water'] = { min = 1, max = 1 },
                }
            },
            rare = {
                chance = 30,
                items = {
                    ['weapon_pistol'] = { min = 1, max = 1 }
                }
            },
            epic = {
                chance = 10,
                items = {
                    ['epic'] = { min = 1, max = 1 }
                }
            }
        },
        rewardsMinMax = { minRewards = 1, maxRewards = 2 }
    },

    legendary = {
        itemName = 'legendary',
        requireItem = 'lockpick',
        LockpickBreakChance = 0.5,
        SoftlockAttempts = 10,
        allowedZones = {},
        timedWindows = {},
        alertJob = nil,
        skillCheck = {
            EnableSkillCheck = true,
            ProcessTime = 15,
            SkillCheckDifficulty = { 'easy', 'easy' }, -- 'hard', 'hard'
            SkillCheckKeys = { 'q', 'e' },
            Anim = nil
        },
        loot = {
            common = {
                chance = 30,
                items = {
                    ['epic'] = { min = 1, max = 2 }
                }
            },
            rare = {
                chance = 40,
                items = {
                    ['weapon_pumpshotgun'] = { min = 1, max = 1 }
                }
            },
            epic = {
                chance = 30,
                items = {
                    ['legendary'] = { min = 1, max = 1 }
                }
            }
        },
        rewardsMinMax = { minRewards = 3, maxRewards = 3 }
    },

    epic = {
        itemName = 'epic',
        requireItem = 'lockpick',
        LockpickBreakChance = 0.5,
        SoftlockAttempts = 15,
        allowedZones = {},
        timedWindows = {},
        alertJob = nil,
        skillCheck = {
            EnableSkillCheck = true,
            ProcessTime = 12,
            SkillCheckDifficulty = { 'easy', 'easy' }, -- 'medium', 'hard'
            SkillCheckKeys = { 'q', 'e' },
            Anim = nil
        },
        loot = {
            common = {
                chance = 40,
                items = {
                    ['epic'] = { min = 1, max = 2 }
                }
            },
            rare = {
                chance = 35,
                items = {
                    ['weapon_pistol'] = { min = 1, max = 1 }
                }
            },
            epic = {
                chance = 25,
                items = {
                    ['weapon_pumpshotgun'] = { min = 1, max = 1 }
                }
            }
        },
        rewardsMinMax = { minRewards = 3, maxRewards = 4 }
    }
}

Config.RarityOrder = { 'common', 'uncommon', 'rare', 'epic', 'legendary' }

Config.LocaleStrings = {
    no_permission = 'Required item not found in inventory.',
    not_in_zone = 'You cannot open this crate here.',
    not_in_time = 'This crate cannot be opened right now.',
    skillcheck_failed = 'Unlocking failed.',
    skillcheck_success = 'Crate successfully unlocked!',
    lockpick_broke = 'Your lockpick broke!',
    crate_softlocked = 'The crate disappeared after too many failed attempts.',
    AlertMessage = 'Suspicious crate opening detected!',
    crate_openingprocess = 'Opening crate in progress...',
}

-- Default animation for all crates if no crate-specific one is specified
Config.DefaultAnim = {
    dict = 'mini@repair',
    clip = 'fixing_a_ped',
    flag = 48
}

-- Notification handlers
Config.Notifications = {
    ox_lib = function(msg, msgType)
        lib.notify({
            position = 'top',
            type = msgType,
            description = msg,
            duration = 5000
        })
    end,

    tnotify = function(msg, msgType)
        exports['t-notify']:Alert({
            style = msgType,
            message = msg,
            duration = 5000
        })
    end,

    okoknotify = function(msg, msgType)
        exports['okokNotify']:Alert('Notification', msg, 3000, msgType)
    end,

    print = function(msg, _)
        print(msg)
    end,

    framework = function(msg, msgType)
        if Config.Framework == "qbcore" then
            QBCore.Functions.Notify(msg, msgType)
        elseif Config.Framework == "esx" then
            ESX.ShowNotification(msg)
        end
    end
}

Last updated