🗃️ SIM Cards
Inventory Requirements
To use SIM cards as items, you need one of the following inventories or any other inventory that supports metadata:
- ox_inventory (Recommended)
- qb-inventory
- ps-inventory
- lj-inventory
- codem-inventory
- core-inventory
Note: For other inventories, you'll need to integrate them yourself.
Configuration
SIM Mode Configuration
Navigate to config/config.sim.lua and configure the SIM mode:
lua-- Whether to enable the SIM switch functionality. -- *manual: When a phone is initialized the phone won't have a SIM card. -- You need to have a SIM card item in your inventory. -- You can assign the SIM card to the phone via Settings app -> SIM Manager. -- *auto_generate: When a phone is initialized, it will automatically -- generate a SIM card and add it to the phone. Config.Sim.Mode = 'auto_generate' -- options: 'manual', 'auto_generate'
SIM Switch Settings
lua-- Whether to enable the SIM switch functionality from the Settings app (Settings -> SIM Manager). Config.Sim.EnableSimSwitch = true
SIM Card Item Setup
QB-Inventory Format
Add to qb-core/shared/items.lua:
luays_sim_card = { name = 'ys_sim_card', label = 'Sim Card', weight = 10, type = 'item', image = 'ys_sim_card.png', unique = true, useable = false, shouldClose = false, combinable = nil, description = 'A sim card' },
OX-Inventory Format
Add to ox_inventory/data/items.lua:
lua['ys_sim_card'] = { label = 'Sim Card', stack = false, weight = 10, consume = 0, },
SIM Modes Explained
Manual Mode
- How it works: Players start without a SIM card in their phone
- Usage: Players must obtain a SIM card item and insert it via Settings -> SIM Manager
- Benefits: More realistic, allows for SIM card trading/selling
- Drawbacks: Requires players to actively manage SIM cards
Auto Generate Mode
- How it works: Automatically creates and assigns a SIM card when phone is initialized
- Usage: No player interaction required
- Benefits: Seamless experience, no management required
- Drawbacks: Less realistic, no SIM card economy
SIM Management Features
SIM Manager (Settings App)
- Access: Settings app -> SIM Manager
- Functions:
- View current SIM information
- Remove current SIM card
- Insert new SIM card from inventory
- View SIM card details (number)
SIM Card Properties
- Card ID: Unique identifier for each SIM card
- Phone Number: Associated phone number
- Metadata: Stored in item metadata for persistence
Implementation Examples
Creating SIM Cards via Command
lua/createSimCard <simCardNumber>
Troubleshooting
Common Issues
- SIM cards not working: Check inventory integration is properly configured
- Metadata not saving: Ensure inventory supports metadata
- SIM Manager not accessible: Verify
Config.Sim.EnableSimSwitch = true - Auto-generation failing: Check SIM generation callback is working
Debug Steps
- Check server console for SIM-related errors
- Verify item definitions are correct for your inventory
- Test SIM card generation manually
- Ensure database permissions for SIM data storage