Keys¶
Buying a property gives the buyer a key. Every key carries the serial of the lock it fits, and each property has one lock at a time.
- Using a key at a door locks or unlocks that door, if the key fits. Only the key used counts, not others in the player's pockets.
- Storage and blips count any fitting key the player carries.
- Changing the locks gives the property a new lock. Every old key stops working.
If a player's inventory is full when they buy, nothing is charged and they're asked to make room. If a key copy or lock change won't fit, the materials are given back and the old lock stays.
Locksmiths¶
A player with one of Config.Locksmith.jobs can:
- Copy a key by using it at one of
Config.Locksmith.locations. CostsConfig.Locksmith.cost. - Change the locks with
/changelocksat the door, with the owner standing next to them. The locksmith gets the new key.
Other scripts can do the same through the exports (tr-government's office uses them).
Lockpicking¶
Using a lockpick near a door, or a storage, starts the lockpick minigame:
- Success on a door flips that one door: locked becomes unlocked, and unlocked becomes locked.
- Success on storage opens it once. Nothing stays unlocked.
- Failure uses up the lockpick (unless
removeOnFailis off).
Doors on unowned properties can be picked too. They lock themselves again after Config.Lockpick.relockUnowned minutes, and on restart.
Every attempt is logged, and fires an event alert scripts can listen to (see For developers).
Whether a lock can be picked, and how hard, comes from the first of these that's set:
- The door's or storage's own
lockpick - The property's
storageLockpick(storage only) Config.Lockpick.storage(storage only)- The property's (or its type's)
lockpick
false means key only. A table of minigame settings is laid over Config.Lockpick.minigame, so it only needs what's different, e.g. { pins = 5 }.
Setting up a new door¶
Turn on Config.Debug and stand at the door:
/doorcheck <hash>prints whether the game's door system knows the door. Ifentityis0orfalse, it can't lock it; give the door amodel.- Close the door and run
/doorscan. It lists every object within 4 metres. Find the door's model and its heading. /doorlookprints the object you're looking at, if/doorscanlists too much.
Then add the door with its closed heading:
[2917406796] = { coords = vector4(1250.61, 1156.41, 150.23, -59.79), model = "p_door44x" },
The heading is the closed one
Locking turns the door to this heading before holding it. A wrong heading holds the door open at an angle.
Admin¶
/property (ACE-restricted, also works from the server console):
| Command | What it does |
|---|---|
/property <id> owner char <charid> |
Gives the property to a character. |
/property <id> owner job <job> |
Gives the property to a job. |
/property <id> release |
Puts it back on the market. |
/property <id> lock / unlock |
Locks or unlocks every door. |
/property <id> key |
Gives you a key to it. |
Changing an owner by command doesn't hand out a key; use key and give it to them.