Configuration

This showcases and explains the config.lua file within the Pro Pad System!

---@author Rewritten
---@version 3.0.0
---ProPad Configuration - Production Ready

Config = {}

-----------------------------------------------------------
-- GENERAL SETTINGS
-----------------------------------------------------------

-- Debug mode - enables console logging (disable in production)
Config.debug = false

-- Locale: 'en', 'es', 'fr', 'de' (add more in locales folder)
Config.locale = 'en'

-- Framework: 'auto', 'esx', 'qb', 'qbx'
Config.framework = 'auto'

-----------------------------------------------------------
-- THEFT SYSTEM SETTINGS
-----------------------------------------------------------

Config.theft = {
    -- Enable the multi-step theft system
    enabled = true,
    
    -- Require steps to be completed in order
    requireSteps = true,
    
    -- Steps configuration (order matters!)
    steps = {
        {
            id = 'lockpick',
            name = 'lockpick_door',
            enabled = true,
            required = true,
            outsideVehicle = true,  -- Must be done outside vehicle
        },
        {
            id = 'hotwire', 
            name = 'hotwire_vehicle',
            enabled = true,
            required = true,
            outsideVehicle = false, -- Must be inside vehicle
        },
        {
            id = 'program',
            name = 'program_key',
            enabled = true,
            required = true,
            outsideVehicle = false, -- Must be inside vehicle
        },
    },
    
    -- Allow breaking window instead of lockpicking
    allowBreakWindow = true,
    
    -- Window break triggers alarm
    windowBreakTriggersAlarm = true,
    
    -- Cooldown between theft attempts (seconds)
    cooldown = 30,
    
    -- Maximum distance to interact with vehicle
    maxDistance = 3.0,
    
    -- Check if owner is nearby before allowing theft
    checkOwnerNearby = true,
    ownerNearbyDistance = 50.0,
}

-----------------------------------------------------------
-- LOCKPICKING SETTINGS
-----------------------------------------------------------

Config.lockpick = {
    -- Enable lockpicking
    enabled = true,
    
    -- Item required for lockpicking
    item = 'lockpick',
    
    -- Chance to break lockpick on failure (0-100)
    breakChance = 30,
    
    -- Minigame settings
    minigame = {
        enabled = true,
        type = 'ox_lib', -- 'ox_lib', 'ps-ui', 'custom'
        
        -- ox_lib skillCheck settings
        difficulty = {'easy', 'easy', 'medium'},
        keys = {'w', 'a', 's', 'd'},
    },
    
    -- Time to lockpick (ms) if no minigame
    duration = 5000,
    
    -- Animation
    animation = {
        dict = 'anim@amb@clubhouse@tutorial@bkr_tut_ig3@',
        name = 'machinic_loop_mechandplayer',
    },
    
    -- Success/fail chance if no minigame (0-100)
    successChance = 70,
}

-----------------------------------------------------------
-- HOTWIRING SETTINGS
-----------------------------------------------------------

Config.hotwire = {
    -- Enable hotwiring
    enabled = true,
    
    -- Item required for hotwiring (nil = no item required)
    item = nil, -- 'screwdriver'
    
    -- Minigame settings
    minigame = {
        enabled = true,
        type = 'ox_lib',
        
        -- ox_lib skillCheck settings
        difficulty = {'easy', 'easy', 'medium'},
        keys = {'w', 'a', 's', 'd'},
    },
    
    -- Time to hotwire (ms) if no minigame
    duration = 8000,
    
    -- Animation
    animation = {
        dict = 'anim@amb@clubhouse@tutorial@bkr_tut_ig3@',
        name = 'machinic_loop_mechandplayer',
    },
    
    -- Success/fail chance if no minigame (0-100)
    successChance = 60,
    
    -- Failed hotwire triggers alarm
    failTriggersAlarm = true,
}

-----------------------------------------------------------
-- WINDOW BREAKING SETTINGS
-----------------------------------------------------------

Config.windowBreak = {
    -- Enable window breaking
    enabled = true,
    
    -- Item required (nil = no item, just punch)
    item = nil,
    
    -- Duration (ms)
    duration = 2000,
    
    -- Use GTA's break-in animation (true) or custom animation from Config.animations (false)
    useScenario = true,
    
    animation = {
        dict = 'melee@unarmed@streamed_core',
        name = 'heavy_punch_a',
    },
    
    -- Always succeeds
    alwaysSucceed = true,
    
    -- Triggers vehicle alarm
    triggersAlarm = true,
}

-----------------------------------------------------------
-- ALARM SYSTEM
-----------------------------------------------------------

Config.alarm = {
    -- Enable vehicle alarms
    enabled = true,
    
    -- Alarm duration (seconds)
    duration = 30,
    
    -- Alarm attracts police
    alertPolice = true,
    
    -- Police alert delay after alarm (seconds)
    policeAlertDelay = 10,
    
    -- Chance for vehicle to have alarm (0-100)
    -- Can also be set per vehicle class
    chance = 50,
    
    -- Vehicle classes with higher alarm chance
    highSecurityClasses = {
        [0] = 80,   -- Compacts
        [1] = 80,   -- Sedans
        [2] = 90,   -- SUVs
        [3] = 85,   -- Coupes
        [4] = 75,   -- Muscle
        [5] = 95,   -- Sports Classics
        [6] = 95,   -- Sports
        [7] = 99,   -- Super
        [8] = 60,   -- Motorcycles
        [9] = 70,   -- Off-road
        [18] = 50,  -- Emergency (shouldn't be stolen anyway)
    },
}

-----------------------------------------------------------
-- KEY SYSTEM CONFIGURATION
-----------------------------------------------------------

Config.keySystem = {
    -- Item name of the programmable key (required to program keys)
    programmableKey = 'programmable_key',
    
    -- Item name of the car key (created after programming)
    carKey = 'carkey',
    
    -- Key system to use:
    -- 'qb-vehiclekeys', 'jaksam-vehicles-keys', 'mk_vehiclekeys', 'qs-vehiclekeys',
    -- 'wasabi_carlock', 'wx_carlock', 'cd_garage', 'okokGarage', 't1ger_keys',
    -- 'MrNewbVehicleKeys', 'Renewed', 'mx_carkeys', 'tgiann-hotwire', 'custom', 'none'
    keySystem = 'wx_carlock',
}

-----------------------------------------------------------
-- MINIGAME CONFIGURATION (for ProPad UI)
-----------------------------------------------------------

Config.minigames = {
    -- Enable/disable minigames during vehicle preparation
    enabled = true,
    
    -- Minigame type: 'ox_lib', 'ps-ui', 'custom'
    minigame = 'ox_lib',
}

-----------------------------------------------------------
-- DISPATCH CONFIGURATION
-----------------------------------------------------------

Config.dispatch = {
    -- Enable/disable dispatch calls
    enabled = true,
    
    -- Dispatch type: 'cd', 'rcore', 'qs', 'ps', 'custom', 'none'
    type = 'cd',
    
    -- When to alert police
    alertOn = {
        lockpickFail = false,
        hotwireFail = true,
        windowBreak = true,
        alarm = true,
        keyProgrammed = true,
    },
    
    -- Percentage chance of dispatch being called (0-100)
    chance = 50,
    
    -- Cooldown between dispatch calls (seconds)
    cooldown = 60,
}

-----------------------------------------------------------
-- VEHICLE OWNERSHIP / DATABASE
-----------------------------------------------------------

Config.ownership = {
    -- Allow transferring vehicle ownership after programming
    allowFullyStealing = false,
    
    -- Database table for vehicles (auto-detected based on framework)
    -- ESX: 'owned_vehicles', QBCore: 'player_vehicles'
    vehicleTable = 'auto',
    
    -- Column names (auto = auto-detect)
    ownerColumn = 'auto',
    plateColumn = 'plate',
    vehicleColumn = 'auto',
}

-----------------------------------------------------------
-- BLACKLISTED VEHICLES
-----------------------------------------------------------

-- Vehicles that cannot be stolen/programmed
Config.blacklist = {
    -- By model name
    models = {
        'police',
        'police2',
        'police3',
        'police4',
        'policeb',
        'policet',
        'sheriff',
        'sheriff2',
        'fbi',
        'fbi2',
        'ambulance',
        'firetruk',
        'riot',
        'pbus',
        'pranger',
    },
    
    -- By vehicle class (see https://docs.fivem.net/natives/?_0x29439776AAA00A62)
    classes = {
        -- 18 = Emergency
        -- 19 = Military
    },
    
    -- By plate pattern (regex)
    plates = {
        -- '^POLICE',  -- Plates starting with POLICE
        -- '^EMS',     -- Plates starting with EMS
    },
}

-----------------------------------------------------------
-- TARGET/INTERACTION SYSTEM
-----------------------------------------------------------

Config.target = {
    -- Enable target system integration
    enabled = true,
    
    -- Target system: 'ox_target', 'qb-target', 'qtarget', 'none'
    system = 'ox_target',
    
    -- Add target options to locked vehicles
    addToLockedVehicles = true,
    
    -- Target options
    options = {
        lockpick = {
            icon = 'fas fa-key',
            label = 'Lockpick Door',
            distance = 2.0,
        },
        breakWindow = {
            icon = 'fas fa-hand-fist',
            label = 'Break Window',
            distance = 2.0,
        },
    },
}

-----------------------------------------------------------
-- ITEMS CONFIGURATION
-----------------------------------------------------------

Config.items = {
    -- ProPad device
    propad = {
        name = 'propad',
        label = 'ProPad',
        useable = true,
    },
    
    -- OBD2 Cable (required for vehicle preparation)
    obd2Cable = {
        name = 'obd2_cable',
        label = 'OBD2 Cable',
        required = true,           -- Set to false to not require cable
        consumeOnUse = true,       -- Cable is consumed when used
    },
    
    -- Programmable key blank
    programmableKey = {
        name = 'programmable_key',
        label = 'Programmable Key',
        consumeOnUse = true,
    },
    
    -- Lockpick
    lockpick = {
        name = 'lockpick',
        label = 'Lockpick',
        consumeOnBreak = true,
    },
    
    -- Screwdriver (for hotwiring)
    screwdriver = {
        name = 'screwdriver',
        label = 'Screwdriver',
        consumeOnUse = false,
    },
}

-----------------------------------------------------------
-- ANIMATIONS & PROPS
-----------------------------------------------------------

Config.animations = {
    -- Lockpicking animation
    lockpick = {
        dict = 'anim@amb@clubhouse@tutorial@bkr_tut_ig3@',
        name = 'machinic_loop_mechandplayer',
        flag = 16,
    },
    
    -- Hotwiring animation
    hotwire = {
        dict = 'anim@amb@clubhouse@tutorial@bkr_tut_ig3@',
        name = 'machinic_loop_mechandplayer',
        flag = 16,
    },
    
    -- Window breaking animation (punch/elbow to break window)
    windowBreak = {
        dict = 'melee@unarmed@streamed_core',
        name = 'heavy_punch_a',
        flag = 48,
    },
    
    -- Using ProPad animation
    propad = {
        dict = 'amb@world_human_seat_wall_tablet@female@base',
        name = 'base',
        flag = 49,
    },
}

Config.props = {
    -- Lockpick prop
    lockpick = {
        model = 'prop_tool_screwdvr01',
        bone = 57005,
        offset = vector3(0.12, 0.02, -0.01),
        rotation = vector3(-100.0, 0.0, 0.0),
    },
    
    -- Tablet/ProPad prop
    propad = {
        model = 'prop_cs_tablet',
        bone = 28422,
        offset = vector3(0.0, 0.0, 0.03),
        rotation = vector3(0.0, 0.0, 0.0),
    },
}

-----------------------------------------------------------
-- SOUNDS
-----------------------------------------------------------

Config.sounds = {
    -- Use native sounds or custom sounds
    useNative = true,
    
    lockpickSuccess = {
        native = true,
        name = 'PICK_LOCK',
        set = 'HUD_LIQUOR_STORE_SOUNDSET',
    },
    
    lockpickFail = {
        native = true,
        name = 'LOSE_MATCH',
        set = 'HUD_MINI_GAME_SOUNDSET',
    },
    
    windowBreak = {
        native = true,
        name = 'Glass_Window_Break',
        set = 'DLC_HEIST_PLANNING_BOARD_SOUNDS',
    },
    
    alarm = {
        native = true,
        name = 'VEHICLES_HORNS_AMBULANCE_WARNING',
        set = nil,
    },
    
    hotwireSuccess = {
        native = true,
        name = 'SELECT',
        set = 'HUD_FRONTEND_DEFAULT_SOUNDSET',
    },
}

-----------------------------------------------------------
-- DEBUG PRINT FUNCTION
-----------------------------------------------------------

---@param message string
---@param level? string 'info'|'warn'|'error'|'debug'
function DebugPrint(message, level)
    if not Config.debug then return end
    
    level = level or 'info'
    local prefix = '[YBNPropad]'
    
    if level == 'error' then
        print('^1' .. prefix .. ' [ERROR]^7 ' .. tostring(message))
    elseif level == 'warn' then
        print('^3' .. prefix .. ' [WARN]^7 ' .. tostring(message))
    elseif level == 'debug' then
        print('^5' .. prefix .. ' [DEBUG]^7 ' .. tostring(message))
    else
        print('^2' .. prefix .. ' [INFO]^7 ' .. tostring(message))
    end
end

-----------------------------------------------------------
-- CUSTOM FUNCTIONS (Override these as needed)
-----------------------------------------------------------

-- Custom minigame function
-- Return true on success, false on failure
function CustomMinigame()
    return true
end

-- Custom key system function (client-side)
function CustomKeySystemClient(plate, vehicleEntity)
    return true
end

-- Custom key system function (server-side)
function CustomKeySystemServer(src, plate, model)
    return true
end

-- Custom dispatch function
function CustomDispatch(coords, type)
    -- type: 'lockpick_fail', 'hotwire_fail', 'window_break', 'alarm', 'key_programmed'
end

-- Custom vehicle check (return true to allow, false to block)
function CustomVehicleCheck(vehicle)
    return true
end

Last updated