[ESX] Custom Car Locking Script (V2 UPDATED)

Hand made, simple plug-n-play car locking script, just a bit nicer looking!

Default Keybind : [“U”]

Features:

  • Car Locking Ped Animation
  • Car Horn Beep (if outside vehicle)
  • Displays in Notification the Cars Number Plate
  • Notifying you that it’s locked (thanks to ox_lib notify)
  • Fixed common bugs with cars remaining locked
    –UPDATED–
  • 2 Different notifications, if you have ox_lib on your server (HIGHLY recommend) then you can use the green notification, if not, the basic ESX notification will do, just tab out the one you don’t want to use in the client script. I have removed the use of SkeexsNotify.

Add to server.cfg

start LERP-CarLock

If anyone uses this please let me know! I love sharing my scripts from my FiveM Server and love seeing other people using them too :smiley:


LERP-CarLock.rar (4.3 KB)

14 Likes

Resmon?

2 Likes

It’s nice to have such a good script to control the car like this
It’s great!

2 Likes

Is this what you mean @KekkoITA ? I’ve never done that before so I hope that gives you what you’re looking for!

3 Likes

Yes, thanks

1 Like

is there a way to add a job check? i have police/ambulance/tow vehicles that are spawned in and am unable to lock them

Yes and no - as spawned in vehicles have no owner (not to pin to an identifier or anything)

I mean it’s possilbe (not logical) to have a script where someone with the right job allows them to lock any of that jobs’ vehicle (by model name i.e Model:Policex5 or something) but that could cause a lot of problems lmao.

Your best bet is to have all of those vehicles either owned by a society (if you’re using ESX, most job scripts have Config.EnableSocietyOwnedVehicles or whatever) which then can be tied to a job that’s lockable, or just have your players jobs purchase vehicles through a garage, thus meaning they own the vehicle - this method has been the workaround for years

Nice script, also where can i find this ymap for the parking ?

how to change the button to L

EUK-Carlock/client/main.lua:127

elseif IsControlJustReleased(0, 173)

Just change 173 to the whichever number you like, I believe L is 7?

VV Replace for this (maybe) VV

elseif IsControlJustReleased(0, 7)

it works, thanks

1 Like

I also came to think about that, at some point but also realize that the scripts that do not save vehicles from works with the owner, such as when they take them to the workshop for tuning, when saving and removing them again, the thuning is not saved because the work It generates it instantly and it does not allow you to block your vehicle because it does not register it with the owner.

i used a free script and edited it myself so that emergency vehicles and utility vehicles like tow trucks and the mule or non owned vehicles will have essentially a free key. no job checks. i would say just grab a simple one and edit it. i use 2 scripts. this one and another. its not the best but its the quick solution. eventually ill just merge the two. but 2 separate gives me the freedom to grab a non owned. and owned quickly. no issues on locking either.

2 Likes

Do you know why players cant lock their Aircrafts? Helis/Planes etc.

They can lock it from the inside but not from the outside

I haven’t even explored that option to lock those vehicles! that would be cool.

Do they own the Aircrafts? if it’s in the owned_vehicles database it should let you. Let me know!

I saw the issue already. The Native GetClosestVehicle that you are using, doesnt and cant return aircraft amd boats

where can i change the keybind?

EUK-Carlock → client → main.lua and then look for

		if IsControlJustReleased(0, 47) and IsInputDisabled(0) then
			ToggleVehicleLock()
			Citizen.Wait(400)

“47” is the button G so by changing that number you can change the button too. Numbers for the keys can be found here.

How do i change notification script?

is possible to remove car owner?, so every car be able to lock/unlock after you enter in.