Job Key System
Job keys are universal master keys that grant access to multiple doors based on a player’s job and grade.
How It Works
Unlike regular door keys that are specific to one door, job keys:
- Grant access to all doors configured for that job
- Are universal for a job role (not tied to specific doors)
- Require grade validation per door
- Are automatically validated and removed if invalid
Job Key Item
- Item:
job_door_key(configurable) - Metadata:
{job = "police", description = "Master key for police"} - Stack: No (each key is unique)
💭 Note: Job keys do NOT store grade information. Grade validation happens per-door based on the player’s current grade.
Getting Job Keys
Method 1: NPC Key Dispenser (Recommended)
Set up NPCs that dispense job keys to authorized personnel:
- Create a door lock (any door)
- Configure job access for that door
- In the door lock editor, scroll to “NPC Location”
- Click “Pick NPC location”
- Aim at the desired location and left-click
- An NPC will spawn at that location
How players get keys:
- Walk up to the NPC
- Press the interaction key
- If authorized (correct job/grade), receive a job key
- If already have a key, receive a message
NPC Configuration:
- Each NPC is linked to a door’s job access list
- NPCs validate job and grade before dispensing
- Only one key per job per player
- Keys are universal but validated per-door
✅ Tip: NPC dispensers provide the most immersive roleplay experience.
Using Job Keys
As a Player
- Walk up to a door configured for your job
- Use the job key item from your inventory
- If your current job/grade matches the door’s requirements:
- The door toggles (lock/unlock)
- A key animation plays
- If your grade is insufficient:
- You see an error message
- The door remains locked
⚠️ Important: Grade validation happens at the time of use, not when the key is given. The same key can open different doors based on your current grade.
Grade Validation
Job keys use a smart validation system:
Universal Keys with Per-Door Grades
- Key is universal - One key for all police doors
- Validation is per-door - Each door can require different grades
- Current grade matters - Your grade at time of use is checked
Example:
-- Door 1: Police Station Front Door
-- Job Access: police, grades [0, 1, 2, 3, 4]
-- Door 2: Police Armory
-- Job Access: police, grades [3, 4]
-- Officer Smith (police, grade 2):
-- ✅ Can open Front Door (grades 0-4 allowed)
-- ❌ Cannot open Armory (grades 3-4 required)
-- Sergeant Jones (police, grade 3):
-- ✅ Can open Front Door
-- ✅ Can open ArmoryAutomatic Validation & Cleanup
The system automatically validates job keys:
On Key Receipt:
- Checks if player has the correct job
- Removes key if job doesn’t match
On Key Use:
- Checks current job matches key’s job
- Checks current grade meets door’s requirements
- Removes key if job changed
On Job Change:
- Invalid keys are automatically removed
- Player is notified
💭 Note: This prevents exploits where players keep keys after job changes.
Configuring Job Access on Doors
In the door lock creator/editor:
Step 1: Add Job Access
- Scroll to “Access by job”
- Click “Add job”
- Enter the job name (e.g., “police”)
- Choose grade requirements
Step 2: Grade Options
Option A: All Grades
- Toggle “All grades”
- Any player with this job can access
- Recommended for: Common areas, break rooms
Option B: Specific Grades
- Untoggle “All grades”
- Enter grade numbers (e.g., 3, 4)
- Only players with these grades can access
- Recommended for: Armories, evidence rooms, chief’s office
Step 3: Multiple Jobs
Add multiple jobs if needed:
- Police and sheriff can both access
- Different grade requirements per job
- Each job needs its own job key
✅ Tip: Use job access with fingerprint scanners for quick, secure access to high-traffic areas.
Setting Up NPC Key Dispensers
Best Practices for NPC Placement
- Place in secure areas - Captain’s office, HR department
- Near the job’s main area - Inside police station, not outside
- Clear line of sight - Players should see the NPC
- Logical location - Where keys would realistically be given
Configuring NPC Behavior
NPC Model (Optional):
-- In door lock editor
npcModel = "s_m_y_cop_01" -- or any valid ped modelIf no model specified, a default model is used.
NPC Interaction:
- Interaction radius: Automatic (based on target system)
- Interaction key: Configured by tc_lib target system
- One key per player per job
- Validates job/grade before dispensing
Losing Job Keys
You may lose your job key when:
- Job changes - Keys are removed when you change jobs
- Fired/demoted - Keys may be revoked if you lose your position
- Disciplinary action - Keys can be taken for disciplinary reasons
- Off duty - Some servers remove keys when you go off duty (optional)
Automatic Removal
Job keys are automatically removed when:
- Player’s job changes
- Player receives a job key for the wrong job (validation fails)
Validation System
The job key system includes smart validation:
- On receiving key - System checks if you have the correct job
- On using key - System validates your current job and grade match the door’s requirements
- On job change - Invalid keys are automatically removed from your inventory
This prevents exploits where players keep keys after changing jobs.
Tips & Best Practices
- Use NPC dispensers - More immersive than automatic key giving
- Place NPCs in secure areas - Prevent unauthorized access to dispensers
- Set appropriate grade requirements - Not all doors need high-grade access
- Combine with fingerprint scanners - Job keys + fingerprint = quick secure access
- One NPC per job area - Police get keys from police NPC, ambulance from ambulance NPC
- Don’t remove keys on off-duty - Unless your server rules require it
- Use per-door grade requirements - Different doors can require different ranks