โ๏ธConfiguration
1๏ธโฃ Customize the BattlePass Settings
Navigate to:
๐ resources/0bug_Battlepass/Customize.lua
Modify the settings as needed:
Customize = {
Lang = "en", -- Set language
ItemImagePath = "nui://qb-inventory/html/images/", -- Path for inventory images
Tebex_Credit_Readme_Code_Command = "purchase_credit", -- Command for purchasing credits
Tebex_Premium_Readme_Code_Command = "purchase_premium" -- Command for purchasing premium pass
}
๐ Tip: Set ItemImagePath to match your inventory system (qb-inventory, ox_inventory, etc.).
2๏ธโฃ UI & XP Settings
Configure UI and XP settings inside Customize.lua
:
UI_Settings = {
Open_Buy_More_Credits_Web_Site = "https://0bugscripts.tebex.io/", -- Tebex store link
Buy_Level_Price = 5, -- Price per level
Buy_Level_Price_Type = "credit", -- Options: "credit", "cash", "bank"
Total_XP = 500, -- XP required to complete the BattlePass
Daily_Quiz_Award = "1000", -- XP reward for correct quiz answers
Daily_Get_Spin_Credit = 1 -- Credits needed for extra spins
}
3๏ธโฃ BattlePass Commands
Here are the available commands you can modify:
Command = {
Open_Menu = "openMenu", -- Opens the BattlePass UI
Add_Level = "addLevel", -- Add levels to a player
Remove_Level = "removeLevel", -- Remove levels
Add_XP = "addXP", -- Grant XP manually
Set_Premium = "setPremium", -- Activate Premium for a player
Clear_Player_Data = "refreshPlayerData", -- Reset a single playerโs data
Clear_Players_Data = "allRefreshPlayersData", -- Reset all playersโ data
Clear_Script_Data = "refreshScriptData" -- Reset entire BattlePass script data
Add_Credit = "addCredit", -- Add credit to a player
Remove_Credit = "removeCredit", -- Remove credit
Get_Credit = "getCredit", -- Get credit
}
When it comes to ESX, you need to use the player's license identifier, and make sure you remove the license:
part but for QBCore/QBox you need to use the player's CitizenID .
You can verify what identifier the script is considering for the player under the data/player.json file
/addXP a8f50ba88b40bb1677dbd2baaa7af12c68a057ed 10 -- ESX
/addXP EAX123EE 10 -- QBCore or QBox
4๏ธโฃ Season & Daily Spin Settings
Manage BattlePass duration, daily resets, and spins in Customize.lua
:
Data_Settings = {
endingTime = 30, -- BattlePass season duration (days)
dailySpin = true, -- Enable or disable daily spin
restartDailyDataHours = "00:00", -- Time to reset daily missions
restartWeeklyDays = 7 -- Weekly mission reset interval (days)
}
5๏ธโฃ BattlePass Server Exports
Before using these exports, you need to get the player's identifier for ESX and the player CitizenID for QBCore.
Example:
local playerId = source -- Gets the player's server ID
local identifier = GetPlayerIdentifier(playerId, 0):gsub('license:', '') -- Retrieves the player's unique identifier
QBCore
local src = source
local Player = QBCore.Functions.GetPlayer(src)
local identifier = Player.PlayerData.citizenid
๐ฎ Player Data Functions
๐น addLevel(identifier, amount)
Increases a player's level by a given amount.
Usage:
exports['0bug_Battlepass']:addLevel(identifier, 1)
๐น removeLevel(identifier, amount)
Decreases a player's level by a given amount.
Usage:
exports['0bug_Battlepass']:removeLevel(identifier, 1)
๐น addXP(identifier, amount)
Adds XP to a player. If XP exceeds the max, it levels up the player.
Usage:
exports['0bug_Battlepass']:addXP(identifier, 500)
๐น setPremium(identifier, value)
Sets a player's premium status (true
or false
).
Usage:
exports['0bug_Battlepass']:setPremium(identifier, true)
๐ฐ Credit Functions
๐น addCredit(identifier, amount)
Adds credits to a player.
Usage:
exports['0bug_Battlepass']:addCredit(identifier, 100)
๐น removeCredit(identifier, amount)
Removes credits from a player.
Usage:
exports['0bug_Battlepass']:removeCredit(identifier, 50)
๐น getCredit(identifier)
Returns the player's current credit balance.
Usage:
local credit = exports['0bug_Battlepass']:getCredit(identifier)
print("Player Credit:", credit)
๐ Data Management Functions
๐น clearPlayerData(identifier)
Clears all stored data for a specific player.
Usage:
exports['0bug_Battlepass']:clearPlayerData(identifier)
๐น clearPlayersData()
Clears all players' data.
Usage:
exports['0bug_Battlepass']:clearPlayersData()
๐น clearScriptData()
Resets script-related data (e.g., daily missions, spins, weekly missions).
Usage:
exports['0bug_Battlepass']:clearScriptData()
๐ Notes
Use
GetPlayerIdentifier(source, 0)
to get the player's unique identifier.Make sure
0bug_Battlepass
is started before using these exports.
๐ฏ Configuring Missions, Quiz, & Rewards
โ
Editing Missions & Rewards
Navigate to:
๐ resources/0bug_Battlepass/config/
This folder contains JSON files for:
dailyMissionsList.json
(Daily missions)weeklyMissions.json
(Weekly missions)dailyQuizList.json
(Daily quiz)dailySpinList.json
(Spin rewards)freeProducts.json
(Free rewards)premiumProducts.json
(Premium rewards)
๐ Adding a Daily or Weekly Mission
{
"title": "Buy Something from the Store",
"description": "Visit a store and purchase any item.",
"value": 1,
"totalValue": 3,
"trigger": "0bug-Battlepass:BuyFromStore",
"triggerAddXP": 50
}
๐น How it works:
title
: Name of the mission.description
: What players need to do.totalValue
: How many times they must complete it.trigger
: The event that grants XP when triggered.triggerAddXP
: How much XP players earn for completing it.
When adding support for daily and weekly missions, we need to ensure that both the client-side and server-side events are properly triggered.
๐ Server-Side Integration
To make the mission work, add the event you did set in the config inside another script (e.g., when a player eats ๐) :
RegisterNetEvent('consumables:server:addHunger', function(amount)
local Player = QBCore.Functions.GetPlayer(source)
if not Player then return end
Player.Functions.SetMetaData('hunger', amount)
TriggerClientEvent('hud:client:UpdateNeeds', source, amount, Player.PlayerData.metadata.thirst)
TriggerClientEvent('0bug-Battlepass:EatFood', source) -- ๐น This triggers XP for the BattlePass
end)
๐ Client-Side Integration
๐ Modify your client-side script (e.g., consumables.lua
) to add XP when a player drinks ๐ง
RegisterNetEvent('consumables:client:Drink', function(itemName)
QBCore.Functions.Progressbar('drink_something', Lang:t('consumables.drink_progress'), 5000, false, true, {
disableMovement = false,
disableCarMovement = false,
disableMouse = false,
disableCombat = true
}, {
animDict = 'mp_player_intdrink',
anim = 'loop_bottle',
flags = 49
}, {
model = 'vw_prop_casino_water_bottle_01a',
bone = 60309,
coords = vec3(0.0, 0.0, -0.05),
rotation = vec3(0.0, 0.0, -40),
}, {}, function() -- Done
-- Remove the item from inventory
TriggerEvent('qb-inventory:client:ItemBox', QBCore.Shared.Items[itemName], 'remove')
-- Update thirst level
TriggerServerEvent('consumables:server:addThirst', QBCore.Functions.GetPlayerData().metadata.thirst + Config.Consumables.drink[itemName])
-- ๐น Add BattlePass XP by triggering the mission event
TriggerEvent('0bug-Battlepass:DrinkWater') -- Client-side event
end)
end)
๐ Setting Up Daily Quiz Questions
Daily quiz questions are stored in:
๐ resources/0bug_Battlepass/config/dailyQuizList.json
Each question follows this structure:
"1": {
"question": "Which establishment allows players to modify their vehicles?",
"answers": [
{
"title": "Auto Tune Garage",
"correct": false
},
{
"title": "Speedy Custom Shop",
"correct": true
},
{
"title": "Wrench Masters",
"correct": false
},
{
"title": "Elite Mechanics",
"correct": false
}
]
}
๐น Explanation
"1"
: Unique identifier for each quiz question."question"
: The question players will see."answers"
: A list of possible answers."title"
: The answer text."correct"
: Set totrue
for the correct answer, all others should befalse
.
๐ Setting Up Free & Premium Rewards
BattlePass rewards are stored in:
๐ resources/0bug_Battlepass/config/freeProducts.json
(for free rewards)
๐ resources/0bug_Battlepass/config/premiumProducts.json
(for premium rewards)
Each reward follows this structure:
{
"id": 1,
"type": "item",
"title": "Sandwich",
"name": "sandwich",
"amount": 5
},
{
"id": 2,
"type": "cash",
"title": "Cash Reward",
"name": "cash",
"amount": 1000
},
{
"id": 3,
"type": "car",
"title": "BMX",
"name": "bmx",
"customImage": "bmx.png",
"amount": 1
},
{
"id": 4,
"type": "item",
"title": "Lockpick",
"name": "lockpick",
"amount": 5
},
{
"id": 5,
"type": "xp",
"title": "XP Reward",
"name": "xp",
"amount": 50
}
๐น Explanation
"id"
: Unique identifier for the reward."type"
: Defines the type of reward."title"
: The display name for the reward."name"
: The database identifier of the item, vehicle, or currency."amount"
: The quantity of the reward."customImage"
(optional): If you add a custom image, place the image in: ๐resources/0bug_Battlepass/resources/image/
"item"
โ A regular inventory item."illegalItem"
โ An illegal item."cash"
โ In-game money."car"
โ A vehicle reward."xp"
โ Experience points.
๐ก Setting Up Daily Spin Rewards
Daily Spin rewards are stored in:
๐ resources/0bug_Battlepass/config/dailySpinList.json
Each reward follows this structure:
"1": [
{
"id": 1,
"type": "item",
"title": "Lockpick",
"name": "lockpick",
"probability": 3,
"amount": 5
},
{
"id": 2,
"type": "cash",
"title": "Cash Reward",
"name": "cash",
"probability": 5,
"amount": 1000
},
{
"id": 3,
"type": "car",
"title": "BMX",
"name": "bmx",
"customImage": "bmx.png",
"probability": 2,
"amount": 1
}
]
๐น Explanation
"id"
: Unique identifier for the reward."type"
: Defines the type of reward. Options:"item"
โ A regular inventory item."illegalItem"
โ An illegal item."cash"
โ In-game money."car"
โ A vehicle reward."xp"
โ Experience points.
"title"
: Name of the reward displayed in the UI."name"
: The item, cash, or car identifier used in the database."probability"
: Chance (out of 100) to get this reward."amount"
: The quantity of the reward."customImage"
(optional): If you add a custom image, place the image in: ๐resources/0bug_Battlepass/resources/image/
Last updated