Exports
This page documents all the available exports provided by the Sky Battlepass resource.
Client Exportsβ
HasBattlepassLoaded()
Checks if the client-side of the battlepass has loaded.
local loaded = exports['sky_battlepass']:HasBattlepassLoaded()
-- return : boolean
ShowBattlepass(show)
Shows or hides the battlepass UI.
exports['sky_battlepass']:ShowBattlepass(true) -- shows the battlepass UI
exports['sky_battlepass']:ShowBattlepass(false) -- hides the battlepass UI#
Server Exportsβ
AddQuest(src, name)
Adds a quest to a player's active quest list.
local worked = exports['sky_battlepass']:AddQuest(src, name)
-- @src : number : player server id
-- @name : string : name of the quest
-- return : boolean : true if everything worked fine
AddPlayerQuestProgress(src, name, amount)
Adds progress towards a player's active quest.
local worked = exports['sky_battlepass']:AddPlayerQuestProgress(src, name, amount)
-- @src : number : player server id
-- @name : string : name of the quest
-- @amount : number : percentage (max 100)
-- return : boolean : true if everything worked fine
AddPlayerXp(src, amount)
Adds battlepass xp to a player.
local worked = exports['sky_battlepass']:AddPlayerXp(src, amount)
-- @src : number : player server id
-- @amount : number : xp to add
-- return : boolean : true if everything worked fine
GetPlayerQuest(src, name)
Retrieves the progress and completion status of a specific quest for a player.
local data = exports['sky_battlepass']:GetPlayerQuest(src, name)
-- @src : number : player server id
-- @name : string : name of the quest
-- return : table : data of a quest
-- data-structure (example) --
data = {
id = 1,
name = "drive_5000",
progress = 50,
claimed = false
}
GetPlayerQuests(src)
Retrieves a list of all the active quests for a player.
local data = exports['sky_battlepass']:GetPlayerQuests(src)
-- @src : number : player server id
-- return : table : data of all active quests
-- data-structure (example) --
data = {
{
id = 1,
name = 'drive_5000',
progress = 50,
claimed = false,
},
{
id = 2,
name = 'drive_5000_bmx',
progress = 10,
claimed = false,
},
}
GetQuestData(name)
Retrieves the common data of a quest.
local data = exports['sky_battlepass']:GetQuestData(name)
-- @name : string : quest name
-- return : table : common data of the quest (ispremium, untilAvailable, ...)
-- data-structure (example) --
data = {
name = "drive_5000",
label = "Drive 5000m",
description = "Drive more than 5000m",
xp = 1000, -- rewarded xp
premium = false, -- is it a premium quest
untilAvailable = 0, -- unix timestamp
}
HasPremium(src)
Checks if a player has the premium battlepass.
local hasPremium = exports['sky_battlepass']:HasPremium(src)
-- @src : number : player server id
-- return : boolean : has the player the premium battlepass
GivePremium(src)
Gives a player the premium battlepass.
local worked = exports['sky_battlepass']:GivePremium(src)
-- @src : number : player server id
-- return : boolean : true if everything worked fine
RemovePremium(src)
Removes a player the premium battlepass.
local worked = exports['sky_battlepass']:RemovePremium(src)
-- @src : number : player server id
-- return : boolean : true if everything worked fine