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

I did an update get in github and redownload the client file

thanks! I check and if necessary I will write :slight_smile:

everything is ok, now I have to block at home that you can not start the engine without cabling, because I have to click “m” and I can start the engine and drive the car

1 Like

where do i need to put the exports if i am using esx_advancedgarage like an older version of this. maybe you can help me and put it where it belongs

function SpawnVehicle(vehicle, plate)
ESX.Game.SpawnVehicle(vehicle.model, this_Garage.SpawnPlace, this_Garage.Heading, function(callback_vehicle)
ESX.Game.SetVehicleProperties(callback_vehicle, vehicle
SetVehRadioStation(callback_vehicle, “OFF”)
SetVehicleFixed(callback_vehicle)
SetVehicleDeformationFixed(callback_vehicle)
SetVehicleUndriveable(callback_vehicle, false)
SetVehicleEngineOn(callback_vehicle, true, true)
–SetVehicleEngineHealth(callback_vehicle, 1000) – Might not be needed
–SetVehicleBodyHealth(callback_vehicle, 1000) – Might not be needed
TaskWarpPedIntoVehicle(GetPlayerPed(-1), callback_vehicle, -1)
end)
TriggerServerEvent(‘esx_advancedgarage:setVehicleState’, plate, false)
end

-- Spawn Vehicles
function SpawnVehicle(vehicle, plate)
	ESX.Game.SpawnVehicle(vehicle.model, this_Garage.Spawner, this_Garage.Heading, function(callback_vehicle)
		ESX.Game.SetVehicleProperties(callback_vehicle, vehicle)
		SetVehRadioStation(callback_vehicle, "OFF")
		SetVehicleFixed(callback_vehicle)
		SetVehicleDeformationFixed(callback_vehicle)
		SetVehicleUndriveable(callback_vehicle, false)
		SetVehicleEngineOn(callback_vehicle, true, true)
		--SetVehicleEngineHealth(callback_vehicle, 1000) -- Might not be needed
		--SetVehicleBodyHealth(callback_vehicle, 1000) -- Might not be needed
		TaskWarpPedIntoVehicle(GetPlayerPed(-1), callback_vehicle, -1)
		exports['xd_locksystem']:givePlayerKeys(plate)
	end)

	TriggerServerEvent('esx_advancedgarage:setVehicleState', plate, false)
end

well now i don’t get an error but i also don’t get the key

maybe you have other script of vehicle lock system?

Hello as I needed to be able to blacklist certain vehicles not only bikes…
I reworked the code a bit

in client/function.lua put this newline:

function isBlacklistedVehicle(vehicle)
local isBlacklisted = false
for _,v in ipairs(Config.NoLockVehicles) do
if GetHashKey(v) == GetEntityModel(vehicle) then
isBlacklisted = true
break;
end
end
if Entity(vehicle).state.ignoreLocks or GetVehicleClass(vehicle) == 13 then isBlacklisted = true end
return isBlacklisted
end

also in confing,lua put this new line:

Config.NoLockVehicles = {
‘trash’,
}

and one more step in client.lua 110 line replace this:

if IsPedInAnyVehicle(ped, false) and driver == ped and not hasKeys and disable == false and not isBlacklistedVehicle(vehicle) then

and voila you can blacklisted whatever you want.

What do you mean you can just add your vehicles models to Config.Blacklist
It can block every model
What you did here is just wasting of your time

when i tested it blacklist other vehicles not only bikes got me again searching for key and hotwires not working for all vehicles so i edit a code and now works for all vehicles.

So maybe you didnt add it correctlmake sure you add

,

After every model

i tried it again, looked through this post and saw that you mentioned to add the line local plate = GetVehicleNumberPlateText(vehicle) but with this i get this error

[     77516] [b2699_GTAProce]             MainThrd/ ^1SCRIPT ERROR: Invalid Lua type in __data^7
[     77516] [b2699_GTAProce]             MainThrd/ ^3> GetVehicleNumberPlateText^7 (^5GetVehicleNumberPlateText.lua^7:4)
[     77516] [b2699_GTAProce]             MainThrd/ ^3> ref^7 (^5@esx_advancedgarage/client/main.lua^7:1316)
[     77516] [b2699_GTAProce]             MainThrd/ ^3> fn^7 (^5@es_extended/client/functions.lua^7:395)

and it changes the plate to something complete different

release an update again

how can i get the keys in xd inventory

From where you got xd_inventory?

Suggestion: When you use the exports exports['xd_locksystem']:givePlayerKeys(plate), it gives you the vehicle to the table owned_vehicles and exports['xd_locksystem']:takePlayerKeys(plate), it takes your vehicle from the same table.

Or, to create other exports that makes that function.

If I press G to look for the keys the progress runs but then the car starts without any hotwire, and its not my own vehicle. what do I have to do to remove that part or what do I need to change

if I understood you correct you want to disable search?

The search is fine What I found is when I want to steal a vehicle its ready to start the engine without hotwire or search but when I press G to search the engine starts.