While working on a server, I couldn’t find anything up-to-date and worth using for locking NPC vehicles. So, I decided to create my own solution, optimizing it as much as possible. Yes, QB Core natively integrates this, but ESX does not. Some garages include it, but they often consume too many resources and add unnecessary load!
That’s why I decided to give this small script to the community for free, created with a modern approach as if it were a paid script – no shortcuts, no half-baked solutions.
What Does It Do?
This simple script will lock NPC vehicles in the most optimized way possible. Once a vehicle is unlocked, it stays unlocked – there’s no performance-consuming loop constantly locking cars. Cars only get locked when you try to open them. This means there’s no interference with car key scripts, garage scripts, or anything else!
Dependencies and Features
This script works with the well-known Lockpick system, and I’ve commented on the code thoroughly to make it easy to adapt. There’s also a configurable chance to alert the police when someone attempts to lockpick a car, which is super easy to adjust.
Optimized for ESX, but also includes QB Core compatibility (though only tested in ESX).
Pre-built for both OX Inventory and QB Inventory.
100% customizable via config.lua for police alerts, lockpick success rates, and more.
You need the script I mention as a dependency in the README, on GITHUB, and everywhere! So no one gets upset for not giving credit (even though I did mention it lol), I’m also mentioning it here: GitHub - baguscodestudio/lockpick: FiveM Lockpick Minigame
Note for QB Core Users
Although the script has QB Core compatibility, I have only tested it in ESX. Since QB Core has a native system for this and it works well, I personally wouldn’t switch if I were using QB.
Feedback
If you like this contribution, I would really appreciate it if you could leave a comment and check out my profile to see more of my work, including free scripts!
But have you even looked at the script? Someone makes a free script for the community, and the first thing they do is criticize it xD Fantastic community.
My script doesn’t include the lockpick script. To use my script, you need the Lockpick script as a dependency. It’s a script that’s over 2 years old and has been used by thousands of creators in countless scripts.
Great script, I tried it and works perfectly. But I don’t know where to customize the police notification, because I don’t use the esx_policejob script. Anyway, thank you very much for your contribution
Hi! Thanks for using the script! In the config, the function is open to make it easier for you You can change what’s after “if Config.AlertPoliceEnable…” and put the export that your Dispatch/Police script should provide. For example, the one you see in the config is for Origen Police, but depending on your system, there will be a different export/function that you need to place there.