[Release][ESX] xd_locksystem | Vehicle Key System!

Thank you very much for the help, starting from that base if buying the car now solved the problem with the keys when I put the car away and when I took it out of the garage it works very well, but now when I pull the server to test when I enter the server and take it out the car in the garage no longer generates the car keys as before, look and I don’t know where to color it to make it work in the garage.
I am using esx_advancedgarage but I am not able to get the keys

Search for ESX.Game.SpawnVehicle in your client script and paste the export inside the function of it


for example

ESX.Game.SpawnVehicle(model, coords, heading, function(vehicle)
	local plate = GetVehicleNumberPlateText(vehicle)
	exports['xd_locksystem']:givePlayerKeys(plate)
end)
1 Like

Sorry for not posting that resolved if someone uses the same garage
exports[‘xd_locksystem’]:givePlayerKeys(carplate), when I hit the H it does the thing of stealing the car but it doesn’t use the lockpicks but if I give it from my inventory it does use them and spends them the other way he does not use them and they do not wear out

so you mean you can hotwire even if you have keys for a vehicle?

let me explain to you how this script works if you don’t get it
you can hotwire normally without lockpick but the chances of succeeding is not that high but,
with lockpick you can success every time you lockpick if the lockpick didn`t break!

1 Like

thank you very much and sorry for the day I gave you, thank you very much and very good job

No problem just happy to help :grinning:

1 Like

As it says here today is your birthday, congratulations and good day

One suggestion, I would change your keys to RegisterKeyMapping instead of doing a loop for checking if a key is press :smile:

You can do whatever you prefer :smile:

Good, how can I get the messages to the phone or mark on the map? I see the message on the police notice console but the police don’t get anything? I have to do something else and sorry for the badge I’m giving you

You need to choose your selected police notify for example you should go to client/main.lua
and search for

police alert

delete the print line and paste a code to notify your police for example

if Config.noKeys.HotwireAlarm then
	local chance = math.random(1, Config.noKeys.HotwireAlarmChance)

	if chance == 1 then
		SetVehicleAlarm(vehicle, true)
		StartVehicleAlarm(vehicle)
		
		-- print('police alert') [Comment this line or delete]
		-- [Add your code for police notify]
		TriggerEvent('policeNotify:send', data)

	end
end
1 Like

thank you very much for the help again hahaha once someone lights the way for me hahaha

Hi, There i was wondering if its Planed for the Future to get or find the Keys as items like for Inventorys with meta Data like ox Inventory i think that would be a nice enhancement

Yes I’m planning to make it better with your idea and other features,
I will update when it will be done.

2 Likes

I’m at this issue here and I’ve added the export under where my vehicle is given to the player after being pulled from garage but I’m getting

SCRIPT ERROR: citizen:/scripting/lua/scheduler.lua:867: No such export givePlayerKeys in resource xd_locksystem

Any thoughts on what’s going on?

EDIT::
NVM Lol I literally had it placed in the wrong area working good!

1 Like

the only weak thing is that if another player wants to put his friend on the driver’s wheel, he has to rob or look for the keys (I know there is a key giving, but yes, the owner of the car removes what is weak).

or it should be so that if the engine is on, you don’t have to rob

This is the idea you are giving the key not duplicating it

Noted, I will do this and update the script

I am happy to. It is mainly about mechanics, when they want to make a vehicle for the client, they have to make it or get a key, so I preferred to write a proposal about the fact that when the engine is turned on, they do not have to rob or something. Thanks for the answer

1 Like