Browse docs

Battle Pass V3

Installation

The database storage and automatic legacy-file migration described here are available from 3.0.5.

Install the current sky_base and configure oxmysql as its SQL adapter. Start the database, framework and configured integrations before these resources:

server.cfg
ensure sky_base
ensure sky_battlepass

Battle Pass automatically creates missing tables and adds missing columns through Sky.DB.Migrate. The included import.sql describes the same schema for reference or manual preparation; no manual SQL import is needed. Existing player records are retained. The database user needs permission to create and alter tables and to read and write their data.

This database-based version does not require add_filesystem_permission sky_base write sky_battlepass. Other installed Sky scripts may still need their filesystem permissions.

Updating an existing installation

  1. Stop sky_battlepass and back up its database tables and any existing data folder.
  2. Replace the resource files, including fxmanifest.lua and the complete source folder. Put your existing data/season.json, data/rewards.json (or the older data/Rewards.json) and data/QuestData.json back in the same resource folder before the first start.
  3. Start the resource. It transfers any available old files into the database in one transaction. Check for [sky_battlepass] Legacy data migration complete in the server console.
  4. Keep the old files in your backup. After a successful import, the resource uses the database; subsequent restarts do not import the files again.

When the old files are present, the import preserves the season number, its original start time and generated rewards. The current weekly quest and its timestamp are also retained. Normal season and weekly resets still apply when they are due.

From 3.0.6, missing files or a missing data folder do not prevent startup. Missing state is initialized directly in the database; no JSON files are created. If season metadata is unavailable, season 1 starts at initialization. Existing XP, premium status and claimed reward levels are retained. Future season and weekly resets still apply. Missing randomized rewards are generated from the current configuration and saved in SQL.

If an existing file is invalid or a transaction fails, startup reports the problem. Correct the reported problem or restore the matching backup, then restart. Do not delete migration markers or import old SQL to retry a completed migration. Transactional tables must use InnoDB.

Configuration

Configure Everything Online
All settings are managed through our config tool

Open Configurator

Commands

Gives or removes premium from a player.

/setpremium [playerId] [true/false]

Generates a new redeem code for premium.

/genpremiumcode

Generates new rewards (only if randomized rewards are enabled).

/generaterewards

Exports

Open the Battle Pass Interface.

client.lua
exports.sky_battlepass:open()

Give premium to a player.

server.lua
exports.sky_battlepass:GivePremium(playerId)

Remove premium from a player.

server.lua
exports.sky_battlepass:RemovePremium(playerId)

Check if a player has premium.

server.lua
local hasPremium = exports.sky_battlepass:HasPremium(playerId)

Give a quest to a player.

server.lua
exports.sky_battlepass:AddQuest(playerId, questName)

Add quest progress to a player quest (used for custom quests).

server.lua
exports.sky_battlepass:AddPlayerQuestProgress(playerId, name, amount)

Give XP to a player.

server.lua
exports.sky_battlepass:AddPlayerXp(playerId, amount)

Custom Quests

Create quests in the configurator and update their progress from your server script. Follow Custom Quests for the setup and AddPlayerQuestProgress example, or Jobs Creator Integration to connect supported collection events.


Custom Rewards

Battle Pass supports custom level, premium, and randomized rewards through the shared sky_base/config/sv_functions.lua reward hook.

See Custom Rewards for the full setup guide and examples.


Support

Need help? Our support team is always ready to assist

Join Discord