[Release][ESX] carlock

Eee cevaplayan kimse olmadı ve sesi biz değiştirdik kimseden yardım almadan senin gibi değiliz yani

Hello, it does not work with work vehicles, my server.lua.

Could you help us, what are we doing wrong?

Thanks for your time

ESX = nil

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

ESX.RegisterServerCallback(‘carlock:isVehicleOwner’, function(source, cb, plate)
local identifier = GetPlayerIdentifier(source, 0)

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)

ESX.RegisterServerCallback(‘carlock:isVehicleOwnerSociety’, function(source, cb, plate)
local xPlayer = ESX.GetPlayerFromId(source)
local job = nil

if xPlayer.job.name == 'garbage' then
	job = 'garbage'
else
	job = 'unemployed'
end

MySQL.Async.fetchAll('SELECT owner FROM owned_vehicles WHERE owner = @owner AND plate = @plate', {
	['@owner'] = 'society:' .. job,
	['@plate'] = plate
}, function(result)
	if result[1] then
		cb(result[1].owner == 'society:' .. job)
	else
		cb(false)
	end
end)

end)

found out how you change the sound?

Hello guys.

How can find this error?

Failed to load script @mysql-async/lib/MySQL.lua

i use newest version mysql-async, async, esplugin-mysql, and vehicleshop.

Did u get this working? Want to try and get it onto my server


Added blinking lights when you lock your car

Sorry I’m late, my server is quite old and MySQL-async could be outdated. However I also get this error but it does work, so I just ignore it.

There is a an exploit when player parked his unlocked car near the another players locked vehicle and then stand between them vehicles then pressed u that player can access another players trunk (Must turn around and face the others player vehicle to work)

thanks for sharing

Hello,
Are you talking about accessing to a vehicle that you don’t own or accessing to a trunk (with something like esx_vehicle_inventory) ?

Yes sir, and it’s them trunk inventories

if lock == 1 or lock == 0 then
							SetVehicleDoorShut(carstrie[i], 0, false)
							SetVehicleDoorShut(carstrie[i], 1, false)
							SetVehicleDoorShut(carstrie[i], 2, false)
							SetVehicleDoorShut(carstrie[i], 3, false)
							SetVehicleDoorsLocked(carstrie[i], 2)
							PlayVehicleDoorCloseSound(carstrie[i], 1)
							SetVehicleLights(carstrie[i], 2)--активируем световой индикатор сигнализации

added line SetVehicleLights(carstrie[i], 2)

Okay, so go to esx_vehicle_inventory/client/main.lua. Then go to line 101, you should find something like this

if locked == 1 or class == 15 or class == 16 or class == 14 then

Change it to

if locked == 1 or locked == 2 or class == 15 or class == 16 or class == 14 then

People shouldn’t be able to access a locked vehicle’s trunk anymore

NOT Working, it made all trunk accessible even though its locked.

2 Likes

Go to line 106 and replace

else

by

elseif locked == 2 then

Also switch back

if locked == 1 or locked == 2 or class == 15 or class == 16 or class == 14 then

to

if locked == 1 or class == 15 or class == 16 or class == 14 then

at line 101

So like this ?

if ESX.UI.Menu.IsOpen(“default”, GetCurrentResourceName(), “inventory”) then
SetVehicleDoorShut(vehFront, 5, false)
elseif locked == 2 then
if locked == 1 or class == 15 or class == 16 or class == 14 then
SetVehicleDoorOpen(vehFront, 5, false, false)
ESX.UI.Menu.CloseAll()

Still working.

The White car is the other player locked vehicle and on the right is mine which is unlocked

Unfortunately I can’t provide full compatibility for every esx vehicle script. I use this native

SetVehicleDoorsLocked(vehicle, LockStatus)

with LockStatus = 2 to lock a vehicle. I’m sorry but you’ll have to search a bit in your trunk script.

Thanks, nice simple script and works perfectly.

BROTHER CAN YOU SHARE INVENTORY AND TRUNK SCRIPT PLEASE ?! I dont have trunk sctipt for store anythink on car !