π Physical Keys
Physical keys are inventory items that open a property's locks. Each key carries a bitting code for one lock. Owners cut keys from the property menu, and locksmith peds copy them.
Requirements
- ox_inventory. Physical keys turn themselves off when
ox_inventoryis not started.
- 1
Add the items to ox_inventory
Add these items to
ox_inventory/data/items.lua. The item names must match the names in Settings β Physical Keys. The full list of the script's items, including the property document, is on ox_inventory Items.ox_inventory/data/items.luaThe Rename buttons let players give a key or keychain their own name, up to 40 characters. The key still opens the same lock.
Item images are set by the script, so you don't need to add image files.
- 2
- 3
Settings
All of these are in Settings β Physical Keys.
Cutting keys
Owners, and keyholders allowed to, manage keys from the property menu:
- Open the property's management menu.
- Go to Access β Locks.
- Pick a lock, then Issue to myself or Issue to nearby player.
Change Lock re-keys the lock. A new bitting code is made and every old key for that lock stops working.
A key in the player's inventory, or in a keychain they carry, opens its lock.
Lock types
Bitting code
Each key's code says which lock it opens:
PPPPPP: property ID, 6 digits.T: lock type.LLLL: lock ID, 4 digits.RRRRR: random code, 5 digits by default.
For example, 000001_E_0000_63323 is the main entrance of property 1.
Locksmiths and key wax
At a locksmith, players can:
- Copy a key they carry, for the locksmith's key price.
- Create a key from a bitting code, if the locksmith allows it. If Allow creating invalid keys is on, the locksmith cuts the key even when the code doesn't match a lock.
- Buy key wax and keychains, if the locksmith sells them.
There is a short cooldown between copies.
To take an impression, drag a blank key_wax onto a housing_key in the inventory and confirm. The wax becomes key_wax_used with the key's code. Using the used wax copies the code to the clipboard, ready for a locksmith.
Exports
These server exports are available for other scripts: