Reward Loyalty and Total playtime
Server Side
Server export
exports.bt_primeco:getPlayerGameTime(source)
Return a table with player's total playtime in minutes and hours.
Example :
local TimePlayed = exports.bt_primeco:getPlayerGameTime(source)
print("Minute : " .. TimePlayed.minute .. " Hour : " .. TimePlayed.hour)
Here is an excerpt from the config.lua file : (parts of the excerpt are hidden)
Config = {
discord_webhook = "", -- Discord canal webhook (ex : https://discord.com/api/webhooks/1212121212/StmZ_AazZZykg69RY1gRZnp7h4121212AZAbAbBlWxyJzaMq
discord_log_name = "BT_PRIMECO", -- The title of the Discord message.
MAX_CONNECT_TIME = 240, --240 minutes -> 4 hours. When player reach 240 minutes he get one FINAL_REWARD
REFRESH_TIME = 60, -- 60 seconds
CUSTOM_REWARD = false, -- You can set to true to custom your rewards. It disable script reward. Use CustomReward() function in this file.
REWARD_PER_HOUR = { TYPE = 0, MIN = 1, MAX = 3}, -- VORP : TYPE 0 = MONEY, 1 = GOLD, 2 = ROL | REDEM : TYPE 0 = MONEY, TYPE 1 AND TYPE 2 = MONEY BANK
FINAL_REWARD = { TYPE = 2, MIN = 1, MAX = 1}, -- VORP : TYPE 0 MONEY, 1 = GOLD, 2 = ROL | REDEM :TYPE 0 = MONEY, TYPE 1 AND TYPE 2 = MONEY BANK
MONEY_NAME = "$",
GOLD_NAME = "Gold",
ROL_NAME = "Diams",
THANKS_MESSAGE = "Thank you for you fidelity :)",
REWARD_MESSAGE = "Reward for %s hours played", -- %d for hours
CURRENCY_MSG = "+ %s %s" -- first %s = amount, second %s = $ or Gold or Diams | Example : + 6 $ or + 6 Gold or + 6 Diams
}
-- this content is hidden in the excerpt
-- SET CUSTOM_REWARD to TRUE
function CustomReward(source, timeSinceLastReboot, totalPlayTime)
-- VORP EXAMPLE
local User = VorpCore.getUser(source)
if User then
local Character = User.getUsedCharacter
if timeSinceLastReboot == 2 then -- 2 hours played since last reboot
Character.addCurrency(1, 20) -- Add 20 Gold
SendNotification(source, "+20 Gold")
end
if totalPlayTime == 100 then -- 100 hours total play time
Character.addCurrency(0, 50) -- Add 50 $
SendNotification(source, "+50 $")
end
end
-- REDEM Example
local User = RedEM.GetPlayer(source)
if User then
if timeSinceLastReboot == 2 then -- 2 hours played since last reboot
User.AddMoney(20) -- Add 20 $
SendNotification(source, "+20 $")
end
if totalPlayTime == 100 then -- 100 hours total play time
User.AddBankMoney(50) -- Add 50 $ to bank account
SendNotification(source, "+50 Bank $")
end
end
end
-- this content is hidden in the excerpt
Last updated