The RSG-Core Advent Calendar is a Lua script designed for the RedM platform, specifically for use with the RSG-Core framework. It implements an advent calendar system that allows players to interact with a virtual advent calendar, typically during the month of December (unless configured otherwise), to receive daily rewards. The script manages player interactions, tracks which days have been opened, and distributes rewards such as in-game money or items.
Key Features
- Advent Calendar System:
- Players can interact with an in-game item called adventcalendar to access the advent calendar.
- The calendar allows players to open one "door" per day, corresponding to the current day of the month (e.g., December 1st to 25th).
- The system checks whether the current day matches the door being opened and ensures players can only open each day's door once.
- Configurable Availability:
- By default, the calendar is only usable in December, but the Config.AlwaysAvailable setting in config.lua allows it to be used year-round if set to true.
- Rewards System:
- Rewards are defined in config.lua for each day (1 to 25), with examples including:
- Day 1: 50 in-game cash.
- Day 2: 2 units of the item "bread."
- Day 3: 1 unit of the item "water."
- If no specific reward is defined for a day, a default reward of 50 cash is given.
- Rewards can be either money (added to the player's cash balance) or items (added to the player's inventory with a notification).
- Rewards are defined in config.lua for each day (1 to 25), with examples including:
- Persistent Data:
- The script uses a JSON file (calendar_data.json) to store which days each player has opened, identified by their citizenid (a unique identifier from the RSG-Core framework).
- Data is loaded when the resource starts and saved whenever a player opens a new day.
- Notifications:
- The script uses the ox_lib notification system to inform players of actions, such as:
- Attempting to open a door on the wrong day.
- Attempting to reopen a previously opened day.
- Attempting to use the calendar outside of December (if AlwaysAvailable is false).
- The script uses the ox_lib notification system to inform players of actions, such as:
- Integration with RSG-Core:
- The script integrates with the RSG-Core framework for player management, inventory, and money systems.
- It uses RSG-Core's CreateUseableItem function to make the adventcalendar item interactive.