Config

Config for msk_vehiclekeys

Config = {}
----------------------------------------------------------------
Config.Locale = 'de'
Config.Debug = true
Config.VersionChecker = true
----------------------------------------------------------------
-- Supported Frameworks: AUTO, ESX, QBCore
-- AUTO will look for the correct framework you are using.
Config.Framework = 'AUTO'
----------------------------------------------------------------
-- !!! This function is clientside AND serverside !!!
Config.Notification = function(source, message, typ)
    if IsDuplicityVersion() then -- serverside
        MSK.Notification(source, 'Vehicle Keys', message, typ, 5000)
    else -- clientside
        MSK.Notification('Vehicle Keys', message, typ, 5000)
    end
end
----------------------------------------------------------------
Config.Commands = {
    -- If you set to false then the Hotkey won't work !!!
    lock = {enable = true, command = 'lock'},
    keyMenu = {enable = true, command = 'keyMenu'},

    -- Command for Players to refresh the Owned Vehicles
    -- It will add not existing permanent keys to the player
    refreshKeys = {enable = true, command = 'refreshKeys'}
}

Config.VehicleTarget = {
    enable = true, -- (Un)lock a vehicle with a target system
    selectSeat = true, -- Select the seat you want to sit in

    -- Supported Target: ox_target
    -- You can add your own target in client/main.lua
    script = 'ox_target'
}

Config.Hotkeys = {
    lock = {enable = true, key = 'L'},
    keyMenu = {enable = true, key = 'U'},
}

-- This works with Ace Permissions (add_ace group.? command.? allow)
-- Admins can use the Hotkey to (un)lock a vehicle if it's added to Config.AdminVehicles below, otherwise use the AdminCommand
Config.AdminCommand = {
    enable = true, -- (Un)locks the vehicle if you don't have a key
    command = 'adlock',
    groups = {'superadmin', 'admin'}
}

-- Gives the key item to the player if the player does not have the item for the plate in his inventory
-- For realism, I recommend to set all option to false (keys will be refreshed internal anyway but the player won't get items)
Config.OnRefreshKeys = {
    OnPlayerLoaded = {
        primaryKeys = false,
        secondaryKeys = false,
    },
    OnRefreshKeys = {
        primaryKeys = false,
        secondaryKeys = false,
    },
}
----------------------------------------------------------------
-- Config.GivePrimaryKey is for giving the primary key to another player
-- !!! ox_inventory ONLY !!!
Config.GivePrimaryKey = {
    -- Please do NOT use all 4 options together!
    -- If you set giveSecondaryKey = true then the last 3 options will be ignored
    -- If you set givePrimaryKey = true then set giveSecondaryKey = false

    -- Use this option
    giveSecondaryKey = true, -- If a player gives his primary key to another player, the other player gets a secondary key
    
    -- Or use this options
    givePrimaryKey = false, -- If a player gives his primary key to another player, the other player gets the primary key
    removePrimaryKey = false, -- If a player gives his primary key to another player, the primary key of the player will be removed
    transferOwnership = false, -- If a player gives his primary key to another player, the other player is the owner of the vehicle

    -- If you set transferOwnership = true then the Primary Key will always be removed from the player
}

-- Config.KeyRingSystem is for a Keyring System to save all keys in a second inventory
-- ATTENTION: https://docu.msk-scripts.de/vehiclekeys/guides/installation#ox_inventory
-- !!! ox_inventory ONLY !!!
Config.KeyRingSystem = {
    enable = true,
    item = 'keyring', -- This item is needed to open the Keyrings second inventory

    -- Each item is unique so that you can open the Keyring from another player if you steal his item.
    -- ATTENTION: The Owner of the keyring item will loose all keys that are inside the keyring stash if someone steals the keyring item !!!
    unique = false, 

    -- General Settings for the Keyring stash
    label = 'Your Vehicle Keyring',
    labelOther = 'Others Vehicle Keyring',
    weight = 100000,
    slots = 500,
}
----------------------------------------------------------------
Config.Settings = {
    lockDistance = 8.0, -- maximum distance to lock/unlock a vehicle
    exchangeLocksPrice = 5000, -- Price for exchanging the Vehicle Locks
    transferVehicle = true, -- Allow transfer the vehicle to another player

    lockVehiclesFromNPCs = {
        enable = true, -- True NPC vehicles locked, set to false to unlock NPC vehicles.
        probability = 25 -- Probability whether a vehicle is open // Set to 0 then npc vehicles are always locked
    },

    menu = {
        showSecondaryKeys = true, -- Show Secondary Keys in Keys Menu
        showTempKeys = true, -- Show Temp Keys in Keys Menu
        showExchangeLocks = true, -- Show Exchange Vehicle Locks in Keys Menu
        showTransferVehicle = true, -- Show transfer vehicle to another player

        refreshPlayerKeys = true, -- Refresh Player Keys when opening the keys menu

        -- Supported Menus: ox_context, ox_menu
        -- You can add your own Menu in client/menu.lua
        keysMenu = 'ox_context'
    },

    key = {
        -- ATTENTION: https://docu.msk-scripts.de/vehiclekeys/guides/installation
        needItem = true, -- Need an item to (un)lock the vehicle // With uniqueItems you always need the item
        canUseItem = true, -- Registers the Item as usable
        itemName = 'keys',
        
        -- This is only for inventories with metadata
        -- Set uniqueItems to false if you don't use such an inventory!
        -- Supported inventories: ox_inventory, core_inventory, qs-inventory
        uniqueItems = true,
        inventory = 'ox_inventory',
        itemLabel = 'Vehicle Key',
        plateLabel = 'Plate: %s',

        -- This option is for uniqueItems ONLY
        -- If set to true, the player with a key item can (un)lock the vehicle even though the player hasn't a key internal
        -- Example: Player A steals the vehicle key from Player B then Player A can (un)lock the vehicle
        toggleWithKey = true,
    },

    transfer = {
        -- If you use the Item then the Player and the Vehicle must be next to you!
        needItem = true, -- Need an item to transfer the vehicle
        canUseItem = true, -- Registers the Item as usable
        itemName = 'contract',
    },

    animation = {
        dict = "anim@mp_player_intmenu@key_fob@",
        anim = "fob_click_fp",
        prop = `lr_prop_carkey_fob`, -- Please use `` and NOT '' or ""
    },
}

Config.openTextUI = function(coloredText, uncoloredText)
    exports['okokTextUI']:Open(uncoloredText, 'darkblue', 'left')
end

Config.closeTextUI = function()
    exports['okokTextUI']:Close()
end

-- This is for exchanging the vehicle locks
-- If you set enable = false then you can still use the exports
Config.Locksmith = {
    enable = true, -- Set to false to disable
    defaultTextUI = true, -- Set fals to use the Config.openTextUI function above

    -- Supported Menus: ox_context, ox_menu
    -- You can add your own Menu in client/menu.lua
    menu = 'ox_context',

    targetSystem = {
        -- If you set this to true then you don't get a HelpNotify or TextUI
        enable = true, -- Set true to enable

        -- Supported Target: ox_target
        -- You can add your own target in client/menu.lua
        script = 'ox_target'
    },

    npcVoice = {
        enable = true,
        inRange = 5.0,
        outRange = 5.0
    },

    locations = {
        ['locksmith'] = {
            label = 'Locksmith Service',
            pedmodel = `s_m_m_autoshop_01`, -- Please use `` and NOT '' or ""
            blip = {enable = true, label = 'Locksmith Service', id = 134, scale = 1.0, color = 0},
            coords = {
                vector4(170.02, -1799.55, 29.32, 318.5),
            }
        },
        ['lsc'] = {
            label = 'Locksmith Service',
            pedmodel = `s_m_m_autoshop_01`, -- Please use `` and NOT '' or ""
            blip = {enable = true, label = 'Locksmith Service', id = 134, scale = 1.0, color = 0},
            coords = {
                vector4(-354.61, -128.18, 38.43, 70.2),
            }
        },
        ['benny'] = {
            label = 'Locksmith Service',
            pedmodel = `s_m_m_autoshop_01`, -- Please use `` and NOT '' or ""
            blip = {enable = true, label = 'Locksmith Service', id = 134, scale = 1.0, color = 0},
            coords = {
                vector4(-190.45, -1309.27, 31.3, 357.8),
            }
        },
    }
}
----------------------------------------------------------------
-- Whitelist specific models and plates for which you don't need a key to (un)lock
Config.Whitelist = {
    models = {
        -- Please use `` and NOT '' or ""
        `caddy`, `caddy2`, `caddy3`, `airtug`, `docktug`, `forklift`, `mower`, `tractor2`, 
    },
    plates = {
        -- either exact plates or just a string that should be in the vehicles plate e.g. "ESX" will ignore "12ESX34" too
        "TEST",
    }
}

-- Blacklist specific models and plates so that they cannot be (un)locked
Config.Blacklist = {
    models = {
        -- Please use `` and NOT '' or ""
        `bmx`, `cruiser`, `fixter`, `scorcher`, `tribike`, `tribike2`, `tribike3`, 
    },
    plates = {
        -- either exact plates or just a string that should be in the vehicles plate e.g. "ESX" will ignore "12ESX34" too
        "TEST2",
    }
}

-- Only groups that are configured in Config.AdminCommand are allowed to (un)lock this vehicles
Config.AdminVehicles = {
    models = {
        -- Please use `` and NOT '' or ""
        
    },
    plates = {
        -- either exact plates or just a string that should be in the vehicles plate e.g. "ESX" will ignore "12ESX34" too
        "ADMINCAR",
    }
}
----------------------------------------------------------------
-- Players with specific jobs can (un)lock the vehicle with specific plates or if it is a specific model
-- either exact plates or just a string that should be in the vehicles plate e.g. "ESX" will ignore "12ESX34" too
Config.JobVehicles = {
    ['police'] = {
        models = {
            -- Please use `` and NOT '' or ""
            `police`, `police2`, `police3`, `police4`, `policeb`, `polmav`,
        },
        plates = {
            "LSPD", "POL",
        },
        ranks = {
            ['officer'] = {
                models = {
                    -- Please use `` and NOT '' or ""
                    `police`,
                },
                plates = {
                    "",
                }
            },
        }
    },
    ['ambulance'] = {
        models = {
            -- Please use `` and NOT '' or ""
            `ambulance`, 
        },
        plates = {
            "LSMD", "AMB",
        }
    },
}

Last updated