Exports
Every export of the Battle Pass, with its arguments, return value and an example
6 min read · Updated Dec 3, 2026
Wherever an export asks for who, a number must be the server id of an online player. A string can be a server id or a character id.
Server exports
AddXP
Adds XP to a player. Levels are worked out from the new total.
Side: Server
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
who | number or string | Yes | The player: the server id of an online player (a number), or the character id (citizenid on qbx and qb, identifier on ESX). |
amount | number | Yes | XP to add, 1 or more. Decimals are cut off. |
reason | string | No | Text shown to the player in the notification and passed to the event. |
Returns
number: the new total XP, never above the XP of the last level. false when the player or the amount is not valid.
How to use it
local total = exports.TopXBattlepass:AddXP(source, 250, 'Delivery finished')
if total then
print(('Player %s now has %s XP'):format(source, total))
end
Good to know
- Works for offline players when you pass the character id.
- Fires
topx_battlepass:onXpAdd, andtopx_battlepass:onLevelUpwhen a level is gained.
RemoveXP
Takes XP away from a player. The total never goes below 0.
Side: Server
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
who | number or string | Yes | The player: the server id of an online player (a number), or the character id (citizenid on qbx and qb, identifier on ESX). |
amount | number | Yes | XP to remove, 1 or more. |
reason | string | No | Text shown to the player in the notification and passed to the event. |
Returns
number: the new total XP. false when the player or the amount is not valid.
How to use it
exports.TopXBattlepass:RemoveXP(source, 100, 'Rule break')
Good to know
- Fires
topx_battlepass:onXpRemove.
SetXP
Sets the total XP of a player to an exact value.
Side: Server
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
who | number or string | Yes | The player: the server id of an online player (a number), or the character id (citizenid on qbx and qb, identifier on ESX). |
amount | number | Yes | The new total, from 0 to the XP of the last level. |
reason | string | No | Text shown to the player in the notification and passed to the event. |
Returns
number: the new total XP. false when the player is not valid or the amount is outside the range.
How to use it
exports.TopXBattlepass:SetXP('ABC12345', 0, 'Reset by staff')
Good to know
- Fires
onXpAddoronXpRemovefor the difference, andonLevelUpwhen the new total is a higher level.
GetXP
Reads the total XP of an online player.
Side: Server
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
who | number or string | Yes | An online player: server id (number) or character id (string). |
Returns
number: the XP in the current season. 0 when the player is offline or unknown.
How to use it
local xp = exports.TopXBattlepass:GetXP(source)
GetLevel
Reads the level of an online player.
Side: Server
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
who | number or string | Yes | An online player: server id (number) or character id (string). |
Returns
number: the level in the current season. 0 when the player is offline or unknown.
How to use it
if exports.TopXBattlepass:GetLevel(source) < 10 then
return false -- this job needs level 10
end
HasPremium
Checks if an online player has the premium track.
Side: Server
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
who | number or string | Yes | An online player: server id (number) or character id (string). |
Returns
boolean: true with premium. false without it, or when the player is offline.
How to use it
local price = exports.TopXBattlepass:HasPremium(source) and 500 or 1000
SetPremium
Turns premium on or off for a player.
Side: Server
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
who | number or string | Yes | The player: the server id of an online player (a number), or the character id (citizenid on qbx and qb, identifier on ESX). |
value | boolean | Yes | true gives premium, false or nil removes it. |
Returns
boolean: true when saved. false when the player is not valid or Config.BattlepassTypes is free.
How to use it
exports.TopXBattlepass:SetPremium(source, true)
Good to know
- Works for offline players when you pass the character id.
- Fires
topx_battlepass:onPremiumChangewithby = 'export'. - For Tebex use the console command
battlepass_premium {id}instead, it also keeps purchases of players who never joined.
GetSeason
Reads the current season.
Side: Server
Arguments
None.
Returns
table: { id: number, name: string, maxLevel: number, startedAt: number (unix time), mode: 'timed' or 'permanent', ... }.
How to use it
local season = exports.TopXBattlepass:GetSeason()
print(season.id, season.name)
AddMissionProgress
Moves a mission of an online player forward. This is how a mission of the kind script is filled.
Side: Server
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
who | number or string | Yes | An online player: server id (number) or character id (string). |
missionId | string | Yes | The id of the mission, as made in /battlepassadmin, Missions. |
amount | number | Yes | Progress to add, more than 0. |
Returns
boolean: true only when this call finished the mission. false when the progress was added but the goal is not reached yet, and also when the player, the mission or the amount is not valid, or the mission is already done.
How to use it
-- count one delivered package
AddEventHandler('myjob:server:delivered', function(playerId)
local finished = exports.TopXBattlepass:AddMissionProgress(playerId, 'deliver_packages', 1)
if finished then print('Mission done') end
end)
Good to know
- The XP of the mission is given by itself when it finishes.
- Fires
topx_battlepass:onMissionCompletewhen it finishes.
CompleteMission
Finishes a mission of an online player at once.
Side: Server
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
who | number or string | Yes | An online player: server id (number) or character id (string). |
missionId | string | Yes | The id of the mission. |
Returns
boolean: true when the mission was finished. false when it is unknown, off, already done, or the player is offline.
How to use it
exports.TopXBattlepass:CompleteMission(source, 'first_heist')
Client exports
OpenBattlepass
Opens the battle pass window for the local player, the same as /battlepass.
Side: Client
Arguments
None.
Returns
Nothing.
How to use it
RegisterCommand('rewards', function()
exports.TopXBattlepass:OpenBattlepass()
end, false)
Good to know
- Nothing happens when a TopX window is already open.