Skip to content

Installation

1. Dependencies

Make sure these are installed and started before the playtime reward:

  • Your framework: qb-core, qbx_core or es_extended
  • ox_lib
  • oxmysql
  • vns-core - free and open source, downloaded separately from your Keymaster/cfx Portal (it is not inside the script zip and updates on its own)

vns-core detects your framework automatically. The script has no framework settings of its own.

2. Resource

Copy the vns-reward folder into your resources and start it after vns-core:

ensure qb-core        # or qbx_core / es_extended
ensure ox_lib
ensure oxmysql
ensure vns-core
ensure vns-reward

Ensure order

  • vns-core must be ensured after ox_lib, oxmysql (database), your framework, inventory, target system and your other server scripts such as housing, garages and phone.
  • vns-reward must be ensured after vns-core.

If vns-core starts too early, VNS scripts can't use your database, items, money or other systems. See Installing vns-core.

The same resource works on QBCore, QBox and ESX - there is no separate build to pick.

Folder name

The folder must be named vns-reward. The server script refuses to run under any other name and prints a warning in the console.

3. Database

Nothing to import. On first start the script creates its own table, vns_playtime_rewards, which stores each character's playtime and last payout time.

4. First start

  1. Join the server and load a character - the countdown panel appears with the reward amount.
  2. To test the payout quickly, set Config.Reward.Timer to something short (e.g. 120), restart the resource and wait two refresh ticks. The money lands in the configured account and the counter restarts.

Encrypted variant

config.lua, client/client_open.lua and server/server_open.lua stay editable in the Encrypted variant - everything on this page and the Configuration page can be changed in both variants.

Updating from the previous version

  • vns-core is now required.
  • One resource for all frameworks. The separate ESX and QB builds are gone - replace whichever build you had with the new vns-reward. It now also runs on QBox.
  • No SQL import. Progress is stored in the new vns_playtime_rewards table, created automatically. mysql-async is no longer used; oxmysql is required on every framework.
  • Existing progress is kept. The first time a character loads without an entry in the new table, their old rewardPlaytime and rewardTimer values are copied from players (QBCore/QBox) or users (ESX). The old columns are never modified. Once all players have logged in after the update you can drop them:

    ALTER TABLE players DROP COLUMN rewardPlaytime, DROP COLUMN rewardTimer;   -- QBCore / QBox
    ALTER TABLE users DROP COLUMN rewardPlaytime, DROP COLUMN rewardTimer;     -- ESX
    
  • Price.text removed. The panel text is now built from Config.Reward.Price.price and the new Config.CurrencySymbol, so the shown amount always matches the payout.

  • New Config.MoneyType - pay the reward into 'bank' (default), 'cash' or another account.
  • New Config.Lang.bonus - the payout notification is no longer hardcoded.
  • qb-phone bank event removed by default. If your phone needs to be told about bank deposits, enable the commented line in GiveReward in server/server_open.lua.