Skip to content

Configuration

Everything lives in config.lua, which stays editable in both the Open and Encrypted variant. There are no framework or database options - those are handled by vns-core.

Config.Reward = {
    Timer = 14400,     -- Playtime (seconds) required before the reward is paid
    Refresh = 60,      -- How often (seconds) playtime is counted and saved
    Price = {
        price = 20000, -- Amount paid out; the on-screen price is generated from this value
    }
}

Config.MoneyType = 'bank'
Config.CurrencySymbol = '€'

Config.Lang = {
    bonus = 'You got the bonus!',
}
Option Default What it does
Config.Reward.Timer 14400 Online seconds a character needs for one payout (14400 = 4 hours). Progress is saved, so it accumulates across sessions.
Config.Reward.Refresh 60 How often (seconds) the server adds playtime, saves it and updates the panel.
Config.Reward.Price.price 20000 Amount paid out, and the amount shown on the panel.
Config.MoneyType 'bank' Account the reward is paid into, e.g. 'bank' or 'cash'.
Config.CurrencySymbol '€' Symbol shown in front of the amount on the panel (€20000).
Config.Lang.bonus 'You got the bonus!' Notification shown on payout.

Notes on the timer

  • Playtime is counted in steps of Refresh. A smaller value gives smoother counting and more frequent database saves, at the cost of more queries. Progress since the last tick is lost on a crash or restart, so with the default 60 a player loses at most one minute.
  • Only players with a loaded character are counted.
  • The reward is money only; there is no item reward option. To change what a payout does, edit GiveReward in server/server_open.lua.

Panel

The countdown panel is plain NUI in html/ (index.html, styles.css, app.js). It shows the remaining time as HH:MM plus the reward amount and hides while the pause menu is open. There are no config options for position or colors - edit html/styles.css to move or restyle it.

To change how the amount is displayed (e.g. symbol after the number, thousands separators), edit FormatRewardPrice in client/client_open.lua.

Open files

File Functions
client/client_open.lua IsPlayerLoaded, FormatRewardPrice
server/server_open.lua GetRewardIdentifier, Notify, GiveReward (pays into Config.MoneyType; contains a commented qb-phone bank event), GetLegacyProgress (one-time copy of old rewardPlaytime / rewardTimer data - can be reduced to return nil once all players have migrated)