[FREE] Best Script for Locking NPC Vehicles + Lockpicking with Police Alert | [ESX/QB]

:hammer_and_wrench: Forge NPC Car Lock Script - Optimized and Modern

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.

:key: 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!

:jigsaw: 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

:warning: 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.

:speech_balloon: 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!

:arrow_down: PREVIEW Now: https://youtu.be/WheehD4ErFA?si=zLDIHdQspVeSANik

:arrow_down: Download Now:

Other SCRIPTS :point_down:

Code is accessible Yes
Subscription-based No
Lines (approximately) + 400
Requirements ESX or QB and lockpick script
Support Yes (24/7)
15 Likes

:handshake::blue_heart: Nice job like always

1 Like

Great job Forge i like it and its free :100: :+1: :100: :+1:

Nice work!! :wink:

Hello, Why you used the minigame without said from who its made?

@kheire007

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.

Still, let me explain: In the README, on my script’s own GITHUB, in the FXMANIFEST, and everywhere possible, there’s a link to the original minigame repository from its creator… because without it, my script doesn’t work :sweat_smile: but hey… thanks for your comment. 🩷

1 Like

Thanks! :smiley: @Nukepug @Adrian_chupi

1 Like

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

@DUYPINVN

Hi! Thanks for using the script! In the config, the function is open to make it easier for you :smiley: 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.

3 Likes

Hey, I don’t criticize you :slight_smile: thank you for this script.

2 Likes

nice nice nice nice workkkkk!!!

2 Likes

esperaba esto para esx , gran trabajo

1 Like

Muchas gracias!

1 Like

If you don’t check if the vehicle is locked, and you start the minigame and succeed in the lockpick, the vehicle will still remain locked.