[Release] esx_doorlock

Will this work on garage doors such as prop_ld_garaged_01?

I have confirmed this fixed the issue man, thanks. BUT, it turns out Treeman mislabeled the Sandy Shores PD gates. The front gate is ‘prop_facgate_07b’ and the rear gate is ‘hei_prop_station_gate’. Also, the rear gate of his opens the opposite direction of the others. Also the coords of those gates are off also so one will need to use their dev tool for the right coords.

1 Like

Could you tell me how to make the doors shut immediatly in the right position?

We are already using the script but which line do we have to edit to actually make them shut immediatly

It’s the yaw

1 Like

Hello, can you please help me lock franklins front doors for job “gang”?

get the resource devtools ([Release] DevTools - Standalone Menu for Development) and get the information like the other doors. then just make the job gang if thats what you want.

One question, this release has a maximum of doors that you can close ??

i put this in my fivem server its all working but it will not let me unlock the doors help!!

they are set for someone that has police job

how does this compare to codewalker ? some of the door id’s i get with codewalk are just straight up wrong, i know this because when i use certain id’s that got from other scripts it will work but in codewalk those ids go to different doors, its so weird and confusing sometimes haha.

This can be used live in server

I see people recommending the devtools resource, and I agree that is good for finding doors, however, that does not give you the yaw of a door, So i can not upgrade to the most current version. Does anyone have any ideas on how to find this?

. It gives heading. Plus you can guess it. It doesn’t take very long. I just adjust the yaw and then restart the door lock script. It takes all of 30 seconds to make an adjustment.

Hi, does someone know how to make the door only avaible for Police Boss for example? i can make the doors to be opened by a job, but i dont know how to specify it to a job grade.

good evening, could someone help me?

I have an idea but I have trouble realizing it, the “doorlock” script is based on jobs to allow access

I would have liked to add a parameter, I tried with “lastdigits” it could have been anything else table contained in the database

the ideal would be that in the script “doorlock” in the config file
we can add the player must have, such item
this greatly improved this script and it will allow the player to give for example keys to open the doors

in addition to the conditions already recquired which is the job

thank you

Is there a way to have change the value to a hex from the model instead of the name?

To open with key:
Client:

Citizen.CreateThread(function()
	while true do
		Citizen.Wait(0)
		local playerCoords = GetEntityCoords(PlayerPedId())

		for i=1, #Config.DoorList do
			local doorID   = Config.DoorList[i]
			local distance = GetDistanceBetweenCoords(playerCoords, doorID.objCoords.x, doorID.objCoords.y, doorID.objCoords.z, true)

			local maxDistance = 3.0
			if doorID.distance then
				maxDistance = doorID.distance
			end

			if distance < maxDistance then
				ApplyDoorState(doorID)

				local size = 0.3
				if doorID.size then
					size = doorID.size
				end

				local heading = 0.0
				if doorID.heading then
					heading = doorID.heading
				end

				local displayText = _U('unlocked')

				if doorID.locked then
					displayText = _U('locked')
					
				end

				Draw3DText(doorID.textCoords.x, doorID.textCoords.y,doorID.textCoords.z, displayText)
				
				if IsControlJustReleased(0, Keys['E']) then
					local isAuthorized = IsAuthorized(doorID)
					
					if isAuthorized then

											
						doorID.locked = not doorID.locked

						TriggerServerEvent('esx_doorlock:updateState', i, doorID.locked, heading)
						
					else
						ESX.ShowNotification("You do not have a key to this door")
					end
				end
			end
		end
	end
end)

and:

function IsAuthorized(doorID)
	local Inventory = ESX.GetPlayerData()["inventory"]

	for i = 1, #doorID.authorizedJobs, 1 do
		for invId = 1, #Inventory do
			if Inventory[invId]["count"] > 0 then
				if doorID.authorizedJobs[i] == Inventory[invId]["name"] then
					return true
				end
			end
		end
	end

	return false
end

Server:

function IsAuthorized(jobName, doorID)
	for i=1, #doorID.authorizedJobs, 1 do
		if doorID.authorizedJobs[i] == jobName then
			return true
		end
	end

	return false
end

And then I just changed the “authorizedJobs” to ex. policekey in the config

1 Like

wait so with this… i can make an unlimited amount of keys… and give anyone a key to a specific door/set of doors? btw… could you message me!

how to add own door ? i got new ymap at my server … how to know that prop what name?

if you are building the map you would know the name of the prop you used for the door… otherwise… use something like ive mentioned above… devtools