[Release][ESX] carlock

Did you have an car lock script with lights?

How I can make need item to unlock and lock your car?

It doens’t lock/unlock propably when players are standing near the car. Is there anyway to fix it?

is there a config file to edit the lock key? I love the script and I’m not at my PC, but is there a way to change the lock key?

is there any way to not make it lock the vehicle when pressing DPADUP on the controller? i tried everything but dosent work [dont want to change the keybind]

If you use esx_policejob and stuff like that and have bought the police vehicle from the police garage it should automatically lock them as they are registered as owned vehicles.

It’s telling me there aren’t any vehicles to lock nearby, yet I have my owned vehicle next to me. Any help?

same.

is possible to make the carlock to lock the society owned vehicles?

have u found answer cuz i need it too

yes i edited myself the script

Hey can i DM you and are you willing to share the script or help me out

1 Like

Is not working for new extended final v1


:frowning: not work for me

I don’t have a vehicle nearby. Can someone help me fix it

Hi, this code works for me:

ESX               = nil

TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)

ESX.RegisterServerCallback('carlock:isVehicleOwner', function(source, cb, plate)	
	
	local _source = source
	local xPlayer = ESX.GetPlayerFromId(_source)
	local identifier = xPlayer.getIdentifier()
	MySQL.Async.fetchAll('SELECT owner FROM owned_vehicles WHERE owner = @owner AND plate = @plate', {
		['@owner'] = identifier,
		['@plate'] = plate
	}, function(result)
		if result[1] then
			cb(result[1].owner == identifier)
		else
			cb(false)
		end
	end)
end)

For me it just says there are no vehicles to lock nearby

Hi bro, this is code works for me, try it:

ESX = nil

TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)

ESX.RegisterServerCallback('carlock:isVehicleOwner', function(source, cb, plate)

    local xPlayer = ESX.GetPlayerFromId(source)

    MySQL.Async.fetchAll('SELECT 1 FROM owned_vehicles WHERE owner = @owner AND plate = @plate', {

        ['@owner'] = xPlayer.identifier,

        ['@plate'] = plate

    }, function(result)

        cb(result[1] ~= nil)

    end)

end)
2 Likes

Hi. I have a problem that when i try to lock my car it says ‘No vehicles to lock nearby’

SOLUTION: I JUST CHANGED THE CODE IN SERVER.LUA FILE. YOU CAN DOWNLOAD THE UPDATED AND FIXED SCRIPT HERE: GitHub - sprixGG/esx_carlock at 719164cd6d60cbe3b87ca9549cd25e65fff60506

Could be the solution here?

[CARJOB]🚀 [FREE] CARJOB - Vehicle JOB with permission