AI Core

ai-doorlock

Door locks set in the panel by picking the door in the world, with job and gang access and one lock state for everyone.

ai-doorlock locks doors, gates, garage doors and barriers. Admins add a door by aiming at it in the world; players who may use it lock and unlock it with a prompt that floats on the door itself.

What it does in the game

  • Locking. Walk up to a door you have access to: the prompt Lock ... or Unlock ... floats on the door leaf nearest to you. Press the interact key. Every player sees the same state at once.
  • Who may lock it. Members of the door's jobs (optionally only on duty) or gangs. Players without access do not see the prompt. A door with no jobs and no gangs can be locked by everyone.
  • Door types. Swinging doors (single, double) stay unlocked until they are shut, then lock. Sliding doors and gates lock at once. Garage doors and barriers keep the game's own movement.
  • Locks hold everywhere. A lock holds even when the door is far away and not loaded on your screen.
  • After a restart every door takes its Locked at start state.

Installation

Installed by the AI Core recipe. By hand: ensure ai-doorlock after ai-core. 94 doors come ready: Mission Row and Paleto Bay police stations, Bolingbroke prison, Pacific Standard, Paleto Bank and the five Fleeca banks, Luxury Autos and Pickle Rental.

Never run ai-doorlock and ox_doorlock together: ai-doorlock already answers ox_doorlock's exports, and AI Core refuses players while both run.

Panel settings

Admin panel > Door locks > tab Doors: doors that lock, who may lock them and how they start. One record per door (New door / Delete door). A deleted door stays open.

Door

Pick the door type first, then the door in the world.

SettingWhat it changesDefault for new
NameShown on the prompt (Lock Police front doors). 1-48 characters.
Door typeSingle door, Double door, Sliding door / gate, Double sliding door or Garage door / barrier. Decides how many door objects you pick and how the door locks: swinging doors lock once they are shut, sliding doors and gates lock at once, garage doors and barriers keep the game's own movement.Single door
DoorPick the door in the world with the free camera (it is outlined when aimed at): its model and exact position are filled in. For a double door, one of the two leaves. A button next to it teleports you to the door.
Second doorOnly for a double door or a double sliding door: pick the other leaf the same way. Other door types ignore it.

Access

Who may lock and unlock it, and how it starts.

SettingWhat it changesUnitDefault for new
JobsOnly members of these jobs can use it. Leave jobs and gangs empty for everyone.empty
GangsMembers of these gangs can use it too.empty
Only on dutyJob members must be on duty in that job.on / offoff
Locked at startThe state after a server restart.on / offon
ReachHow close the player must be for the prompt. Gates and garage doors need more. 1-15, steps of 0.5.m2.5

Commands and keybinds

None. The prompt uses the interact key (E by default).

Logs

Every lock and unlock goes to the doors log channel with the player who did it.

What it stands in for

fxProvide: ox_doorlock. exports.ox_doorlock:setDoorState(id, state) and exports.ox_doorlock:getDoor(id) reach ai-doorlock. The provided name takes effect after a full server start.

Other door lock scripts

AI Core's door lock layer also works with tgiann-doorlock, ox_doorlock, qb-doorlock, cd_doorlock and rcore_doorlock. Pick one in the admin panel: Server > General > Door lock script (Automatic takes the first one running) and stop ai-doorlock. Scripts that store door ids (ai-robberies' doors) must then use that script's door ids.

Known limits

  • A door can be flipped at most every half second, and one player can try twice a second ("Wait a moment").
  • A door whose object the game does not have at that spot (a map edit removed it) shows no prompt.
  • Locking an open swinging door waits until it is shut; if it is held open for 15 seconds it is forced shut.

On this page