Vehicle Key System
The vehicle key system manages access to vehicles through physical key items.
How It Works
Each vehicle key is a unique item with metadata containing the vehicle’s license plate:
- Item:
vehicle_key(configurable) - Metadata:
{plate = "ABC 123"} - Stack: No (each key is unique)
Players can only lock/unlock vehicles they have keys for.
Using Vehicle Keys
As a Player
Locking/Unlocking:
- Stand near your vehicle (within 5 meters)
- Use the vehicle key item from your inventory
- The vehicle locks/unlocks with a key fob animation
- A sound plays confirming the action
In-Vehicle:
- Players with keys can freely enter and use vehicles
- Players without keys are restricted (based on bridge configuration)
✅ Tip: The key fob animation and sound make the action feel realistic and satisfying.
How Players Get Vehicle Keys
From Vehicle Purchase
When you purchase a vehicle from a dealership, you automatically receive a vehicle key item in your inventory. This key is linked to your vehicle’s license plate.
From Garage
When you spawn your owned vehicle from a garage, the key is automatically given to you (if not already in inventory).
From Another Player
Other players can give you their vehicle keys if they want to share access. This is useful for:
- Lending your car to a friend
- Giving keys to family members
- Sharing job vehicle access
- Selling vehicles to other players
Admin Commands
Server administrators can give you keys using the /vehiclekeys command. This gives a key to the nearest vehicle.
💭 Note: How keys are distributed depends on your server’s vehicle shop and garage systems.
Losing Vehicle Keys
You may lose vehicle keys when:
- Selling a vehicle - Keys are removed when ownership transfers
- Job shift ends - Job vehicle keys are taken back
- Rental expires - Rental vehicle keys are removed
- Vehicle seized - Police can confiscate keys
- Imprisonment - Keys may be taken when jailed
Vehicle Key Animations
tc_keys includes realistic animations:
Key Fob Animation
Config.KeyFob = joaat("lr_prop_carkey_fob")
Config.KeyFobAnim = {
dict = 'anim@mp_player_intmenu@key_fob@',
name = 'fob_click_fp'
}When a player uses their vehicle key:
- A key fob prop appears in their hand
- They play the key fob click animation
- The vehicle locks/unlocks
- A sound effect plays (carlock.mp3)
✅ Tip: Custom key fob models and animations can be configured in config.lua.
Bridge Integration
tc_keys can work alongside existing vehicle key systems:
Config.EnableBridge = false -- or "qbx_vehiclekeys", "qb_vehiclekeys", etc.Standalone Mode (Recommended)
Config.EnableBridge = false- tc_keys handles all vehicle key functionality
- Full control over key management
- Best performance
- All features supported
Bridge Mode
When bridging with another system:
- tc_keys syncs with the other system
- Keys given in tc_keys are synced to the other system
- Keys given in the other system may not appear in tc_keys
- Some features may be limited
Supported Bridges:
qbx_vehiclekeys- QBox vehicle keysqb_vehiclekeys- QB-Core vehicle keysqs_vehiclekeys- Quasar vehicle keyswasabi_carlock- Wasabi car lock
⚠️ Important: Bridge mode is for compatibility. Standalone mode is recommended for best experience.
Special Situations
Job Vehicles
When you go on duty and receive a job vehicle, you’ll automatically get a key for it. When your shift ends, the key is removed from your inventory.
Rental Vehicles
Rental vehicles work similarly - you receive a key when renting, and it’s automatically removed when the rental period expires.
Shared Vehicles
If multiple people need access to the same vehicle (family car, company vehicle), each person can receive their own key. All keys work on the same vehicle.
Lost or Stolen Keys
If your vehicle key is lost or stolen:
- Contact a mechanic for a duplicate key (if your server has this feature)
- Use an admin to spawn a new key
- Use a locksmith service (if available on your server)
Tips & Best Practices
- Always give keys when spawning owned vehicles - Players expect to have access to their vehicles
- Remove keys when vehicles are sold/transferred - Prevent unauthorized access
- Use nil for current vehicle - Simplifies code when player is in a vehicle
- Check for keys before expensive operations - Validate access before modifications
- Bridge only if needed - Standalone mode provides the best experience