NEW YEAR
FiveM New Year Excitement: Eyes Store Reward Script!
Framework Support: The configuration supports multiple game frameworks such as
QBCore
,ESX
,OLDQBCore
, andNewESX
. This flexibility allows developers to integrate the script within different server setups seamlessly.Daily Rewards System:
The
Day
table within the configuration contains a list of rewards that players can collect each day. Each entry specifies:day
: The day number for which the reward is available.item
: Contains the model of the item and the amount that can be collected (i.e., how many of that item the player will receive).variable
: A boolean flag indicating whether the item is a variable reward or not.collected
: A boolean flag indicating whether the item has already been collected by the player.
Item Addition Functionality:
The
Add
function is responsible for adding items to a player’s inventory.It checks for valid input (player, item, and amount), verifies the amount is a positive number, and then adds the designated item to the specified player's inventory based on the framework being used.
Dynamic Framework Retrieval:
The
GetFramework
function is designed to dynamically retrieve the game framework in use. It handles fetching the necessary shared object for each framework type, ensuring compatibility and ease of use.
Usage Example
Every day, players can collect specific items, motivating them to log in regularly. For example, on day 1, players receive an armor item, while on day 5, they can acquire gold bars. The configuration allows for easy adjustment of days and items based on game design requirements.
Conclusion
This script serves as a robust foundation for implementing a daily rewards system within a game framework. Its support for multiple frameworks and the ability to modify item allocations make it a valuable asset for enhancing player engagement and creating a rewarding game experience.
Feel free to reach out if you have any questions or need further modifications!
This explanation should help your client understand the purpose and functionality of the configuration script.
Item Addition Function in shared.lua
shared.lua
In the shared.lua
configuration file, the Add
function is a crucial component for managing item distribution to players in the game. This function is designed to ensure that items can be added to a player's inventory accurately and efficiently. Below is a detailed breakdown of how the function operates:
Daily Rewards Item Structure In the rewards configuration, each day's item rewards are defined using a standard structure. This structure is vital for managing item allocations effectively from day to day. Below is the breakdown of how the configuration is set up:
Structure Explanation
Day: Each entry specifies a particular day (from 1 to 30) and contains the following key attributes:
item: This is a table containing an item defined by its
model
and thecount
of that item to be given. For example, on Day 1, players receive 1 piece of armor.variable: This boolean field indicates whether the item is a variable reward or not. Items with
variable = true
may differ based on certain conditions or player progress, whilevariable = false
means the item is fixed and will be the same for all players.collected: This boolean field tracks whether the player has collected the item. Initially set to
false
, it changes totrue
once the player collects the item on that specific day.
Example of Daily Item Configuration
For Day 1:
Players receive 1 armor item.
The
variable
is set totrue
, suggesting that the armor could vary or may have options for upgrades or enhancements.The
collected
flag starts asfalse
indicating that the item has not yet been collected.
For Day 6:
Players receive 1 tablet item.
The
variable
is set tofalse
, meaning every player will receive the same tablet.The
collected
flag starts asfalse
, indicating that it has not been collected yet.
Conclusion
This standard item structure within the daily rewards configuration helps facilitate an organized and dynamic rewards system in the game. It fosters player engagement by encouraging daily logins while simplifying management and item tracking through clear boolean flags for variability and collection status.
If you have any more questions or need further insights into how to modify or utilize this structure, please don’t hesitate to ask!
Last updated