Safe System for RSGCore (RedM)
This script is a safe storage system designed for RedM using the RSGCore framework. It allows players to create, place, and use safes to store their items securely.
Features
- Create a safe using a command (
/createsafe
) or an item (stash_creator
). - Customizable safeswith:
- Custom name
- Adjustable weight and slots
- Optional password protection
- Different safe models
- Smooth placement system:
- Players can move the safe before confirming the location.
- Press E to confirm the placement.
- Storage system integration:
- Safes act as stash inventories.
- Password-protected safes require a correct code to open.
- Persistent data storage:
- Safes are saved in the database (
vault
table in MySQL). - Safes remain after server restarts.
- Safes are saved in the database (
- Target system integration (
rsg-target
):- Interact with safes using a targeting system.
- Open safes via an NUI-based input.
Configuration (config.lua)
The config.lua
file allows customization of:
- Framework & Dependencies (
rsg-core
,rsg-target
). - Default safe properties (weight, slots).
- Command and item-based creation.
- Key bindings (Confirm placement with
E
). - Text localization (Safe messages & prompts).
How It Works
Creating a Safe
- Players can use:
- The command (
/createsafe
). - The safe item (
stash_creator
).
- The command (
- A form appears, allowing the player to set:
- Safe name, weight, slots, password, and model.
- After confirming, the player can move the safe before placing it.
- Press E to confirm the placement.
Storing & Retrieving Items
- Players interact with the safe using the targeting system (
rsg-target
). - If the safe has a password, the player must enter it.
- If the password is correct:
- The inventory system opens (
inventory:server:OpenInventory
). - The player can store and retrieve items.
- The inventory system opens (
Data Persistence
- Each safe is saved in the MySQL database (
vault
table). - The server script loads safes on player login or restart.
Dependencies
This script requires: