Skip to content

World devices & 3D keypad ​

np_doors can put a wall device next to an access-controlled door: a PIN keypad, a keycard reader or a fingerprint reader. The device is decoration plus a status LED. The readers stay NUI screens and the server decides every step of the lock chain as before. The one exception is the 3D keypad: at an np_doors keypad the code is typed on the prop itself, and players standing nearby can watch the keys being pressed.

Everything on this page is off by default (Config.Devices.enabled = false). With it off, no prop is registered, no LED is drawn, no per-frame work runs and every door behaves exactly as before.

Not yet checked in game

The models, clips and the 3D keypad are built and covered by the test suite, but have not been run on a live server yet: spawning, the flush fit on a wall or door frame, LED alignment, the look of the materials, the animations on the male and female freemode peds, the 3D keypad's camera framing, click mapping and screen texture swap. The vanilla fallback models and their offsets are unchecked too. Try it on a test server before you turn it on.

np_door_keypad np_door_cardreader np_door_biometric
Keypad Card reader Fingerprint reader
Keypad LED Card reader LED Fingerprint reader LEDs
pin keycard finger, face

Blender renders of the shipped models. The second row simulates the LEDs as the client draws them (green = open).

The props ​

np_doors streams four models of its own from stream/:

Model Used for Size W × D × H (m)
np_door_keypad PIN keypad (lock type pin) and the 3D keypad 0.088 × 0.031 × 0.144
np_door_cardreader Keycard tap reader (keycard) 0.056 × 0.025 × 0.126
np_door_biometric Fingerprint reader (finger, also shown for face) 0.082 × 0.044 × 0.164
np_door_keycard Hand prop: the card in the player's hand during the card tap 0.086 × 0.054 × 0.001

Plus the clip dictionary np_doors_anim_devices.ycd (animations). The wall devices are static archetypes with three LODs, a box collision and no logos or brands. Their origin is the centre of the back face (the side against the wall), with +Y pointing out of the wall, so a device placed on a wall sits flush.

On a door frame The hand prop
The keypad next to a door frame np_door_keycard: a blank card with an olive band and a chip

Status LEDs. The models have dark lens windows. The client lights them in the colour of the door state (locked red, open green, timed yellow-green, alarm blinking, broken flickering, a red flash on a refused factor). One model covers every state, and the per-frame draw only runs while a spawned device with LEDs is within led.range (8 m). The sensor ring of the fingerprint reader lights only on the client of the player whose finger reader is open at that door. The screens of the keypad and the fingerprint reader are a dim emissive idle picture and need no code.

Vanilla fallback. Every model list in Config.Devices.models ends in a vanilla model. An np_* model is only used while its stream/<model>.ydr ships with np_doors; delete stream/ and the fallbacks (prop_ld_keypad_01, hei_prop_hei_securitypanel, ch_prop_fingerprint_scanner_01a) take over by themselves. Vanilla devices get no LEDs, no animation and no 3D keypad, and their origins differ: tune them with Config.Devices.offsets after checking them in game.

Placing a device ​

A door gets a device from a device field:

lua
device = { coords = vector3(...), heading = 90.0, kind = 'keypad' }   -- kind and model are optional

coords is the centre of the device's back face on the wall, heading the direction its front faces (GTA heading). kind ('keypad', 'card' or 'finger') defaults to the first step of the door's lock chain that has a reader (Config.Devices.kindOf: pin → keypad, keycard → card, finger / face → finger), else defaultKind ('card'). model overrides the model list for this door.

Set it in the door definition (shared/config/20_doors.lua), through exports.np_doors:updateDoor(id, { device = ... }) (device = false removes it), or in game:

/doordevice <door id> [keypad|card|finger|off]

The command starts np_prophandler's placement ghost on your client: walls only, within maxFromDoor (3 m) of the door's centre, at most 6 m from you, turning in 5° steps. Confirm saves it. The server checks everything again (device.place): the permission, that devices are on, the kind, that the device lies within maxFromDoor of the door and that you stand within 6 m (plus Config.DistanceTolerance) of it. off removes the device (this also works from the server console).

  • Permissions: np_doors.create or np_doors.manage (np_admin nodes, no ACE).
  • Persistence: the device is part of the door. A door made in game stores it in npd_doors; a config door becomes an override (like any other edit in game). After a restart the saved pose comes back.
  • A config device too far from its door (more than maxFromDoor) is dropped with a warning; the door still loads.
  • The shipped example doors have no device: their wall positions still have to be measured in game.

np_prophandler streams the prop: np_doors registers one prop per door (np_doors:device:<door id>, frozen, no interact), registers them all again on np_prophandler:ready and moves or removes the prop when the door changes.

Animations ​

When a reader opens at a door whose device is one of the np_door_* models, the player steps to a stand point in front of it, faces it and plays a short upper-body clip. Purely cosmetic and client-side: the server never waits for it.

Clip Device Reader Length
card_tap np_door_cardreader keycard 1.9 s, with np_door_keycard in the right hand
keypad_enter np_door_keypad pin 3.87 s (used when the 3D keypad does not run or its per-key clips are off)
finger_scan np_door_biometric finger 2.6 s
Card tap 3D keypad typing
card_tap: the keycard is pushed flat onto the tap ring keypad_hover with press clips chained: 2 5 8 0 #

Previews rendered in Blender on a reference body (not part of the resource), not in game.

When there is no animation. Any missing piece means the reader simply opens without one: animations off, a vanilla device, the clip or the card model missing, the player in a vehicle, the stand point more than stand.maxWalk (2.5 m) away, or a device mounted at an odd height. The clips reach a device centre deviceZ (0.17 m) above the ped's coords, which is about 1.17 m above the floor; a device more than heightTolerance (0.15 m) off that height gets no clip instead of a hand in the air. Mount the devices at about that height.

The settings live in Config.Devices.anim. The clips were authored for these numbers: change them only together with the clips.

Key Default Description
enabled true Device animations (np_admin: live)
dict 'np_doors_anim_devices' The clip dictionary in stream/
flag 48 Upper body plus player control: the legs stay the game's
clips[model] the three rows above { clip, reader, seconds, card? }: the clip a device model plays for a reader kind
stand { side = 0.20, out = 0.40, maxWalk = 2.5, timeoutMs = 2500 } Where the ped stands in device space: side along the device's +X, out from the wall; the longest walk there and how long it may take
deviceZ, heightTolerance 0.17, 0.15 Device centre above the ped's coords the clips reach, and how far off a device may be
card { model = 'np_door_keycard', bone = 57005, pos = vector3(0.172, 0.004, -0.014), rot = vector3(0.0, 90.0, 0.0) } The card held during card_tap, attached with np_prophandler attach (synced, others see it). model = nil: no card

Rotation order of the card hold

np_prophandler attaches with rotation order 1 (ROT_YZX, Ry·Rz·Rx), not GTA's default ZXY. The shipped hold turns about one axis only, so the order does not matter for it. A retuned hold with two or more non-zero angles must be derived in that order.

If np_prophandler limits the models clients may attach (server.attachments.clientModels), add np_door_keycard to that list, or the card tap plays without a card.

3D keypad ​

At a door whose device is a spawned np_door_keypad, a pin step of the lock chain is typed on the wall keypad instead of the NUI keypad. The player steps up to it, a script camera eases in on the keypad face (HUD and world labels hidden) and a transparent overlay takes mouse and keyboard.

Typing on the wall keypad: three of four digits entered, key 5 lit

Mockup: a straight-on render of the prop with the overlay's hint bar, not an in-game screenshot.

Input What
Click a key The nearest key under the cursor (within hitRadius of the on-screen key pitch)
0-9 Digits, top row and numpad
Backspace, Delete, * Clear the entry
Enter, # Submit (with autoSubmit = true the entry submits by itself at full length)
Escape Cancel: the reader closes and the server forgets the chain

The keypad's own screen shows the masked entry, the tries left, "Access granted" and the lockout countdown. While you type, a DUI page (web/dist/keypad.html) replaces the screen texture of the model on your client.

The keypad screen: typing, access granted, wrong code with tries left, lockout countdown

The code goes to the server once, through the same door.factor check as the NUI keypad: the same code length, tries, lockout and alarm. The server only ever compares a salted hash. Death, walking away, Escape and a resource stop restore the camera, the focus, the texture and the animation.

When the NUI keypad is used instead:

  • Config.Devices.enabled = false or Config.Devices.keypad.enabled = false
  • the door's device is a vanilla keypad, or any model without an entry in Config.Devices.keypad.models
  • the keypad prop is not spawned on your client
  • the door's PIN is managed by np_passwords (pin = { provider = 'np_passwords', lock })
  • the player is in a vehicle, more than 2.5 m from the stand point, or the device sits at an odd height (the same checks as the animations)

One texture for every keypad on your screen

The DUI replaces the texture np_dk_screen_d of the model np_door_keypad on your client. While you type, every np_door_keypad you can see shows your entry. Other players still see their own idle picture.

Observable typing ​

At a real keypad you can watch somebody type a code. The 3D keypad keeps that:

  • Per-key clips. The typing ped loops keypad_hover and plays one keypad_press_<key> clip per key (1-9, 0, star, hash). GTA syncs the animation, so bystanders see the finger go to each key. Typing faster than the clips skips older clips (at most anim.maxQueue wait); the digits are never skipped.
  • Key relay. For every key the client sends the RPC keypad.press { id, key }. The server passes "key X at door Y" on to the other players within observable.range (15 m) of the keypad, whose clients light that key and play a beep at the device when the fingertip touches it.

The server only relays a key while the sender has an open lock session at the pin step of that door, the door's device is a configured keypad, the sender stands within reach (2.5 m) plus Config.DistanceTolerance of it (server-side coords, routing bucket 0) and stays under observable.rate / burst (8 / 12 presses per second). A client that keeps exceeding the rate is written to np_admin's audit log (category doors, action spam) at most once a minute. Nothing is decided from a relayed key, and only the key travels, never the code.

The tradeoff

Anything an honest bystander can see, a modified client in range can read too: the relay names the key, and the animation sync shows the finger. The server bounds it by range and rate, but it cannot hide it from players who are there. For keypads whose code must not be observable, turn observable.relay and observable.anim off (both are live settings in np_admin). Then no key is sent to anybody, and with device animations on the typing ped plays the fixed keypad_enter clip instead of one clip per key. The typing player's own key light and beep remain.

Settings ​

Config.Devices.keypad in shared/config/50_devices.lua:

Key Default Description
enabled true The 3D keypad (only while Config.Devices.enabled)
autoSubmit false true: submit at full length, like the NUI keypad. false: # / Enter submits
reach 2.5 Metres (plus Config.DistanceTolerance, server-side coords) a relayed key press may come from
hitRadius 0.6 A click hits the nearest projected key within this share of the on-screen key pitch
models[model].keys the np_door_keypad 3 × 4 grid { labels, columns, origin = vector3, step = { x, z }, size = { w, h } } in prop space (x = viewer's left, y out of the wall, z up), or { list = { ['1'] = vector3(...), ... }, size } for any other layout
models[model].screen txd = 'np_door_keypad', tex = 'np_dk_screen_d', 512 × 128, aspect = 50 / 16 The texture the DUI replaces while typing; aspect is the physical screen, so the page is not stretched
models[model].target vector3(0.0, 0.031, -0.002) What the camera looks at (between screen and keys)
camera.distance, fov, ease 0.30, 22.0, 600 Metres in front of target, field of view, ease in / out in ms
camera.offset vector3(-0.05, 0.0, 0.04) Prop-space offset: beside the arm and a little above, so the finger shows
observable.anim true Per-key clips; false = the fixed keypad_enter clip
observable.relay true The server relay of key presses to players in range
observable.range 15.0 Metres a relayed press reaches (0 to 50; 0 = nobody)
observable.rate, burst 8, 12 Key presses per second (and burst) the server relays per player
observable.flashMs 150 How long a pressed key lights up
observable.contactMs 190 With the per-key clips: light and beep this many ms after a press clip starts (the fingertip touches the key at 0.186 s)
observable.color { 190, 210, 120, 200 } RGBA of the key light
observable.sound { name = 'PIN_BUTTON', set = 'ATM_SOUNDS', range = 6.0 } Vanilla sound at the device per key; name = false = silent
anim.hover 'keypad_hover' Looped while the camera is on the keypad
anim.press 'keypad_press_%s' %s = the key; anim.names maps * → star and # → hash
anim.seconds 0.433 Length of one press clip (each starts and ends on the hover pose)
anim.maxQueue 3 Presses queued for the clips

Settings ​

Config.Devices in shared/config/50_devices.lua. The full key list is also on Configuration.

Key Default Description
enabled false Master switch (np_admin: restart)
spawnDistance 30.0 np_prophandler streaming distance (the models fade out at 30 m)
collision true Collision of the device box; false = walk-through
maxFromDoor 3.0 Metres from the door's centre (of all its parts) a device may sit; raise it for wide gates and garage doors
models.keypad { 'np_door_keypad', 'prop_ld_keypad_01' } First usable model wins
models.card { 'np_door_cardreader', 'hei_prop_hei_securitypanel' }
models.finger { 'np_door_biometric', 'ch_prop_fingerprint_scanner_01a' }
kindOf { pin = 'keypad', keycard = 'card', finger = 'finger', face = 'finger' } The device of a door without device.kind
defaultKind 'card' For doors whose lock chain has no reader step
offsets[model] {} { pos = vector3, heading } added to the stored pose, for models whose origin is not the back face centre (the vanilla fallbacks)
leds[model] the lens windows of the np_door_* models { status = { pos, size }, sensor = { pos, size } } in prop space. Models without an entry get no LED
led.range 8.0 Metres; the per-frame LED draw runs only while a device with LEDs is this close
led.light, led.intensity 0.18, 2.0 Range and intensity of the small light on the lens (light = 0: marker only)
led.colors locked, open, timed, alarm, broken, deny, scan RGB per door state, plus deny (a refused factor) and scan (the fingerprint sensor ring)
anim see Animations
keypad see 3D keypad

Editable in np_admin ​

np_admin's Resource settings → Doors has a Devices group:

Setting Key Applies
Wall devices (keypads, card / fingerprint readers) Devices.enabled restart
Device animations (card tap, PIN, fingerprint) Devices.anim.enabled live
Device LED range (m) Devices.led.range (0 to 30) live
3D keypad (type on the wall keypad) Devices.keypad.enabled live
3D keypad: submit at full length (no #) Devices.keypad.autoSubmit live
3D keypad: per-key animations Devices.keypad.observable.anim live
3D keypad: show key presses to players nearby Devices.keypad.observable.relay live
3D keypad: key press range (m) Devices.keypad.observable.range (0 to 50) live
3D keypad: camera FOV Devices.keypad.camera.fov (10 to 60) live

For developers ​

  • The prop: np_doors:device:<door id>, registered with np_prophandler's registerProps (data = { owner = 'np_doors', door, kind }). Find the entity with np_prophandler's getPropEntity(id) (client) or getProp(id) (server).
  • The door's public view carries device = { prop, kind, model, coords, heading } (the resolved model and the pose with offsets applied), or nothing when devices are off.
  • Exports, RPCs, client events and the NUI / DUI messages are listed on Exports, events & hooks.