# Jota Dev Vehicle Key

<figure><img src="/files/5G1mmSGcVRbMz1tFDwJb" alt=""><figcaption></figcaption></figure>

How to start the script for its correct operation:

**Put in your server.cfg**

```markdown
# JotaDev Vehicle Key System
ensure jc_hacking
ensure jc_map_locksmith
ensure jc_vehiclekeys
```

***

**Commands**

* The admin can give keys to any vehicle to any player:  `/adminaddkey [ID][PLATE]`
* The admin can rm keys from any vehicle belonging to any player:  `/adminremovekey [ID][PLATE]`&#x20;
* The administrator can issue temporary vehicle keys:  `/addtempkey [ID][PLATE]`
* The player can add or remove keys:  `/givekeys` \[L KEY]

**Script Settings:**

{% tabs %}
{% tab title="Setting" %}
{% code expandable="true" %}

```lua
Config = {}

Config.Framework = 'auto'  -- 'esx' //'qb' or 'auto'

Config.Notify = {
    HelpNotify = 'ox_lib', -- 'ox_lib' // 'esx_framework' // 'qb-core'
    Notification = 'ox_lib' -- 'ox_lib'  // 'esx_framework' // 'qb-core'
}

--[[  
Configure your language using the following:
    'es' -> Spanish
    'en' -> English
    'fr' -> French
    'de' -> German
    'it' -> Italian
    'pt' -> Portuguese
]]
Config.Locale = 'en'

Config.Inventory = 'auto' -- 'auto' = It automatically recognizes your inventory as long as it is one of these // 'jpr-inventory' // 'origen_inventory' // 'qs-inventory' // 'codem-inventory' // 'jaksam_inventory' // 'tgiann-inventory' 
Config.Dispatch = 'auto' -- auto = It automatically recognizes your dispatch as long as it is one of these -> p_mdt // origen_police // cd_dispatch // ps-dispatch // 

Config.RequiredItem = {
    requireItem = true, -- You can require the vehicle key item when opening or closing a vehicle, or not, as you prefer
    nameItem = 'vehiclekey',
    --[[
    Enabling metadata makes the vehicle key (the item) specific to that vehicle. If it's disabled, 
    you can open the vehicle with any vehicle key as long as you have the key

    For example, if I have the key for license plate ABC2521 and I lose the key to that car, I won't be able to access the
    key unless I recover the lost key. If this option is deactivated, I can open the vehicle with any vehicle key ("vehiclekey")
    as long as it's assigned to me.
    ]]
    useMetadata = false
}

Config.VehicleJKey = {
    --[[
    You can use 3 types of interactions:
    - "keyonly" -> Simply pressing the predefined U key locks and unlocks the vehicle without any interface
    - "ui1" -> The script will use interface 1, which is the simple, small, round-style controller
    - "ui2" -> The script will use interface 2, which is a small square controller with some additional functions
    ]]
    modeUI = 'ui1',
    MaxKeyDistance = 4.0, -- Distance by which players can open or close the vehicle
    OpenKey = 'U', -- Key to unlock vehicle key
    --[[
    Here you can hear the real sounds of the vehicles 
    you can change them to your liking if you wish
    ]]
    sounds = {
        useSounds = true,
        openVehicleIn = 'close.mp3',
        closeVehileIn = 'close.mp3',
        openoutveh = '',
        closeVehicleOut = 'close_out_vehicle.mp3'
    },
    --[[
    The difference between administrator and user access is that the 
    administrator can give out a key to a vehicle that is NOT theirs
    while the user can only give out keys to their own vehicles
    ]]
    commands = {
        giveKeysAdmin = 'adminaddkey',
        removeKeysAdmin = 'adminremovekey',
        giveTempKeyUsers = 'addtempkey'
    },
    -- Access permissions to administrative commands
    AdminKeys = {
        CheckGroups = true,
        Groups = {
            ace = { "admin", "superadmin" },
            esx = { "superadmin", "admin" },
            qb = { "god", "admin" }
        },
        AllowedIdentifiers = {
            "steam:000000000000000",
            "license:00000000000000000000000000000",
            "discord:0000000000000000000",
        },
    },
    -- This is the user menu to give or take away keys depending on the vehicles you own
    giveKeysMenu = {
        command = 'givekeys',
        key = 'L',
        nearbyRadius = 5.0,
        vehicleRadius = 10.0
    }
}

Config.KeyRecoveryShop = {
    --[[
        Price for retrieving license plates. Remember that this store only applies if `requireItem` is set to `true` 
        as it's a key retrieval store. If you don't require the item, you'll never need to retrieve any keys.
    ]]
    price = 500,
    cooldown = {
        time = 10 * 60, -- Time in minutes it takes to recover vehicle keys
        maxKeys = 2 -- Maximum keys you can recover over time
    },
    locations = { -- Store location for key retrieval
        {
            coords = vector4(-57.6291, -204.802, 45.793, 159.41),
            npc = 's_m_m_autoshop_01',

            blip = {
                enabled = true,
                sprite = 134,
                color = 3,
                scale = 1.0,
                shortRange = true,
                label = 'Key Recovery'
            }
        },

    }
}

-- If you want faction vehicles to be unlocked and everyone with that job to be able to open and close vehicles, add it here!

Config.FactionKeys = {
    enabled = true,
    jobs = {
        ["police"] = {
            models = { "police", "police2" }
        },
        ["ambulance"] = {
            models = { "ambulance", "firetruk" }
        }
    }
}

Config.Debug = false -- Dont Touch This
```

{% endcode %}
{% endtab %}

{% tab title="LockPick" %}
{% code expandable="true" %}

```lua
Config.NPCVehicles = {
    NoLockModels = { -- Whitelist of vehicles that you don't want to be blocked or require hacking
        enabled = true,
        list = {"adder", "neon"}
    },

    VehicleClassKeys = {
        [0] = "compacts",
        [1] = "sedans",
        [2] = "suvs",
        [3] = "coupes",
        [4] = "muscle",
        [5] = "sports_classics",
        [6] = "sports",
        [7] = "super",
        [8] = "motorcycles",
        [9] = "offroad",
        [10] = "industrial",
        [11] = "utility",
        [12] = "vans",
        [13] = "cycles",
        [14] = "boats",
        [15] = "helicopters",
        [16] = "planes",
        [17] = "service",
        [18] = "emergency",
        [19] = "military",
        [20] = "commercial",
        [21] = "trains"
    },

    parked = { -- Settings for parked vehicles
        enabled = true,
        lockedChance = 100, -- Chance of the vehicle being locked when parked

        timezone = { -- Timezone settings for the vehicle
            enabled = false,
            from = 22,
            to = 6
        },

        hacking = {
            byClass = { -- Settings for each vehicle class
                ["compacts"] = {
                    lockpick = {minigame = 'jc_hacking', item = "lockpick", difficulty = 1, attempts = 5, removeItem = true, failedRemoveItem = true},
                    hacking = {minigame = 'jc_hacking', item = "hacking", needItem = false, attempts = 4, removeItem = true}
                },
                ["sedans"] = {
                    lockpick = {minigame = 'jc_hacking', item = "lockpick", difficulty = 1, attempts = 5, removeItem = true, failedRemoveItem = true},
                    hacking = {minigame = 'jc_hacking', item = "hacking", needItem = false, attempts = 4, removeItem = true}
                },
                ["suvs"] = {
                    lockpick = {minigame = 'jc_hacking', item = "lockpick", difficulty = 1, attempts = 5, removeItem = true, failedRemoveItem = true},
                    hacking = {minigame = 'jc_hacking', item = "hacking", needItem = false, attempts = 4, removeItem = true}
                },
                ["coupes"] = {
                    lockpick = {minigame = 'jc_hacking', item = "lockpick", difficulty = 2, attempts = 4, removeItem = true, failedRemoveItem = true},
                    hacking = {minigame = 'jc_hacking', item = "hacking", needItem = false, attempts = 4, removeItem = true}
                },
                ["muscle"] = {
                    lockpick = {minigame = 'jc_hacking', item = "lockpick", difficulty = 2, attempts = 4, removeItem = true, failedRemoveItem = true},
                    hacking = {minigame = 'jc_hacking', item = "hacking", needItem = false, attempts = 4, removeItem = true}
                },
                ["sports_classics"] = {
                    lockpick = {minigame = 'jc_hacking', item = "lockpick", difficulty = 2, attempts = 4, removeItem = true, failedRemoveItem = true},
                    hacking = {minigame = 'jc_hacking', item = "hacking", needItem = false, attempts = 4, removeItem = true}
                },
                ["sports"] = {
                    lockpick = {minigame = 'jc_hacking', item = "lockpick", difficulty = 3, attempts = 3, removeItem = true, failedRemoveItem = true},
                    hacking = {minigame = 'jc_hacking', item = "hacking", needItem = false, attempts = 3, removeItem = true}
                },
                ["super"] = {
                    lockpick = {minigame = 'jc_hacking', item = "lockpick", difficulty = 4, attempts = 2, removeItem = true, failedRemoveItem = true},
                    hacking = {minigame = 'jc_hacking', item = "hacking", needItem = false, attempts = 2, removeItem = true}
                },
                ["motorcycles"] = {
                    lockpick = {minigame = 'jc_hacking', item = "lockpick", difficulty = 2, attempts = 4, removeItem = true, failedRemoveItem = true},
                    hacking = {minigame = 'jc_hacking', item = "hacking", needItem = false, attempts = 4, removeItem = true}
                },
                ["offroad"] = {
                    lockpick = {minigame = 'jc_hacking', item = "lockpick", difficulty = 2, attempts = 4, removeItem = true, failedRemoveItem = true},
                    hacking = {minigame = 'jc_hacking', item = "hacking", needItem = false, attempts = 4, removeItem = true}
                },
                ["industrial"] = {
                    lockpick = {minigame = 'jc_hacking', item = "lockpick", difficulty = 1, attempts = 5, removeItem = true, failedRemoveItem = true},
                    hacking = {minigame = 'jc_hacking', item = "hacking", needItem = false, attempts = 5, removeItem = true}
                },
                ["utility"] = {
                    lockpick = {minigame = 'jc_hacking', item = "lockpick", difficulty = 1, attempts = 5, removeItem = true, failedRemoveItem = true},
                    hacking = {minigame = 'jc_hacking', item = "hacking", needItem = false, attempts = 5, removeItem = true}
                },
                ["vans"] = {
                    lockpick = {minigame = 'jc_hacking', item = "lockpick", difficulty = 1, attempts = 5, removeItem = true, failedRemoveItem = true},
                    hacking = {minigame = 'jc_hacking', item = "hacking", needItem = false, attempts = 5, removeItem = true}
                },
                ["cycles"] = {
                    lockpick = {minigame = 'jc_hacking', item = "lockpick", difficulty = 1, attempts = 5, removeItem = true, failedRemoveItem = true},
                    hacking = {minigame = 'jc_hacking', item = "hacking", needItem = false, attempts = 5, removeItem = true}
                },
                ["boats"] = {
                    lockpick = {minigame = 'jc_hacking', item = "lockpick", difficulty = 2, attempts = 4, removeItem = true, failedRemoveItem = true},
                    hacking = {minigame = 'jc_hacking', item = "hacking", needItem = false, attempts = 4, removeItem = true}
                },
                ["helicopters"] = {
                    lockpick = {minigame = 'jc_hacking', item = "lockpick", difficulty = 4, attempts = 2, removeItem = true, failedRemoveItem = true},
                    hacking = {minigame = 'jc_hacking', item = "hacking", needItem = false, attempts = 2, removeItem = true}
                },
                ["planes"] = {
                    lockpick = {minigame = 'jc_hacking', item = "lockpick", difficulty = 4, attempts = 2, removeItem = true, failedRemoveItem = true},
                    hacking = {minigame = 'jc_hacking', item = "hacking", needItem = false, attempts = 2, removeItem = true}
                },
                ["service"] = {
                    lockpick = {minigame = 'jc_hacking', item = "lockpick", difficulty = 1, attempts = 5, removeItem = true, failedRemoveItem = true},
                    hacking = {minigame = 'jc_hacking', item = "hacking", needItem = false, attempts = 5, removeItem = true}
                },
                ["emergency"] = {
                    lockpick = {minigame = 'jc_hacking', item = "lockpick", difficulty = 3, attempts = 3, removeItem = true, failedRemoveItem = true},
                    hacking = {minigame = 'jc_hacking', item = "hacking", needItem = false, attempts = 3, removeItem = true}
                },
                ["military"] = {
                    lockpick = {minigame = 'jc_hacking', item = "lockpick", difficulty = 4, attempts = 2, removeItem = true, failedRemoveItem = true},
                    hacking = {minigame = 'jc_hacking', item = "hacking", needItem = false, attempts = 2, removeItem = true}
                },
                ["commercial"] = {
                    lockpick = {minigame = 'jc_hacking', item = "lockpick", difficulty = 1, attempts = 5, removeItem = true, failedRemoveItem = true},
                    hacking = {minigame = 'jc_hacking', item = "hacking", needItem = false, attempts = 5, removeItem = true}
                },
                ["trains"] = {
                    lockpick = {minigame = 'jc_hacking', item = "lockpick", difficulty = 1, attempts = 5, removeItem = true, failedRemoveItem = true},
                    hacking = {minigame = 'jc_hacking', item = "hacking", needItem = false, attempts = 5, removeItem = true}
                }
            },
            byModel = { -- Settings for each vehicle model
                ["adder"] = {
                    lockpick = {minigame = 'jc_hacking', item = "lockpick", difficulty = 1, attempts = 5, removeItem = true, failedRemoveItem = true},
                    hacking = {minigame = 'jc_hacking', item = "hacking", needItem = false, attempts = 5, removeItem = true}
                }
            }
        }
    },

    driving = { -- Settings for driving vehicles
        enabled = true,
        lockedChance = 100, -- Chance of the vehicle being locked when driving

        timezone = { -- Timezone settings for the vehicle
            enabled = false,
            from = 22,
            to = 6
        }
    }
}

Config.CallPolice = { -- Settings for calling the police
    enabled = true,
    lockpick = { -- Settings for calling the police when the lockpick is successful or failed
        onSuccess = { chance = 25 },
        onFailed = { chance = 75 }
    },
    hacking = { -- Settings for calling the police when the hacking is successful
        onSuccess = { chance = 25 },
        onFailed = { chance = 75 }
    }
}

Config.NoLockZones = { -- This configuration means that vehicles in the area you mark are not locked and do not need to be hacked
    {
        coords = vector3(374.7035, 274.4459, 103.09),
        radius = 80.0
    },
    {
        coords = vector3(461.0600, 235.8767, 103.21),
        radius = 60.0
    }
}


Config.ProcessRadius = 36.0
Config.ReprocessCooldown = 3000
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jota-dev-documentation.gitbook.io/jota-dev/scripts/jota-dev-vehicle-key.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
