Description: This script creates a safe/stash system where players can place personal storage safes in the game world. Players can:


- Place safes in the world
- Set access codes for their safes
- Store items in their safes
- Destroy their safes
- Access their safes with a code system
- Own multiple safes (up to a configurable limit)
Key Features:
- Password protection system
- Ownership verification
- Persistent storage (saves to database)
- Visual smoke effects when destroying safes
- Vegetation clearing around safe placement (optional)
- Target system integration for interaction
Config Options:
luaCopyConfig.EnableVegModifier = true // Clears vegetation around safe
Config.StashMaxWeight = 5000000 // Maximum weight capacity
Config.StashMaxSlots = 60 // Number of inventory slots
Config.DestroyTime = 10000 // Time to destroy safe (in ms)
Config.MaxStashes = 5 // Maximum safes per character
Config.StashProp = 'p_safe01' // Safe prop modelDependencies:
- RSG-Core (RedM framework)
- RSG-Target (for interaction)
- RSG-Inventory (for storage system)
- ox_lib (for notifications and UI elements)
- MySQL (for database storage)
Database Integration: The script uses MySQL to store:
- Safe locations
- Safe ownership (citizenid)
- Access codes
- Safe properties
- Inventory contents (through RSG-Inventory)
Usage:
- Players can create safes using either:
- Using a "safe" item from inventory
- Safe Interaction:
- Set access codes
- Open inventory
- Destroy safe (owner only)
- Access requires correct code if set
Required Database Tables:
player_safes: Stores safe data (properties, propid, citizenid, access_code)- Inventory tables from RSG-Inventory for item storage
Security Features:
- Server-side ownership verification
- Access code verification
- Anti-spam measures
- Permission checks for destruction
Technical Details:
- Uses prop system for physical representation
- Implements client-server synchronization
- Handles resource stopping/starting
- Includes prop placement validation
- Target system for interaction options
The script is well-structured with separate client and server files, making it maintainable and expandable. It's designed specifically for RedM's environment and integrates well with the RSG framework ecosystem.