πŸ’΅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 played

    • hour : Total hours played


βš™οΈ Configuration Example (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