π΅Reward Loyalty and Total playtime
π§ Server Side
π Export: Get Player Game Time
Retrieve a playerβs total playtime (in minutes and hours) with this export:
local TimePlayed = exports.bt_primeco:getPlayerGameTime(source)
print("Minute : " .. TimePlayed.minute .. " Hour : " .. TimePlayed.hour)
Returns a table:
minute
: Total minutes playedhour
: Total hours played
βοΈ Configuration Example (config.lua
)
config.lua
)Config = {
discord_webhook = "", -- Discord webhook URL
discord_log_name = "BT_PRIMECO", -- Discord log title
MAX_CONNECT_TIME = 240, -- Minutes before FINAL_REWARD (default 4h)
REFRESH_TIME = 60, -- Refresh interval (seconds)
CUSTOM_REWARD = false, -- Set to true to use your own CustomReward function
REWARD_PER_HOUR = { TYPE = 0, MIN = 1, MAX = 3 }, -- Hourly reward
FINAL_REWARD = { TYPE = 2, MIN = 1, MAX = 1 }, -- Final reward after MAX_CONNECT_TIME
MONEY_NAME = "$",
GOLD_NAME = "Gold",
ROL_NAME = "Diams",
THANKS_MESSAGE = "Thank you for you fidelity :)",
REWARD_MESSAGE = "Reward for %s hours played",
CURRENCY_MSG = "+ %s %s"
}
π Custom Rewards
Set CUSTOM_REWARD = true
to handle rewards yourself with the CustomReward(source, timeSinceLastReboot, totalPlayTime)
function.
Example for VORP:
if timeSinceLastReboot == 2 then -- 2 hours since last reboot
Character.addCurrency(1, 20) -- Add 20 Gold
end
if totalPlayTime == 100 then -- 100 total hours
Character.addCurrency(0, 50) -- Add 50 $
end
Example for RedEM:
if timeSinceLastReboot == 2 then
User.AddMoney(20) -- Add 20 $
end
if totalPlayTime == 100 then
User.AddBankMoney(50) -- Add 50 $ to bank account
end
π Notes
Discord logging is supported for playtime/reward events.
Currency types and reward values are fully configurable.
Use the export to display or automate in-game playtime rewards, milestones, or loyalty perks.
Last updated