Skip to content

Admin tools

Kivo Battlepass has a set of chat commands and an in-game admin menu. They are defined in the open files open/admin.lua and open/admin_client.lua.

The permission name is kivo.battlepass.admin. Change it with Config.AdminAce in config/config.lua. Add these lines to server.cfg, using your own group instead of group.admin if needed:

add_ace group.admin kivo.battlepass.admin allow
add_principal group.admin kivo.battlepass.admin

The commands are registered through ox_lib with this permission as their restriction. The admin menu and the actions behind it accept a player when any one of these is true:

  • The player has the kivo.battlepass.admin ACE.
  • The player has the general command ACE.
  • The player is in the admin or god group on QBCore or QBox.
  • The player is in the admin or superadmin group on ESX.

The server console can run every command. From the console, always give a player id, because there is no player to default to.

If you need a different rule for who is an admin, change KivoBP.IsAdmin in bridge/framework.lua. See Exports and bridge files.

Arguments in square brackets are optional. Where an id is left out, the command applies to the player who typed it.

Command What it does
/kivobpadmin Opens the admin menu. Players only, not the console.
/kivobpxp [id] [amount] Gives XP to a player.
/kivobptier [id] [tier] Sets a player’s tier. The tier is kept between 0 and the season’s maxTier.
/kivobppremium [id] Gives a player Premium.
/kivobprevoke [id] Removes a player’s Premium.
/kivobpresetdaily [id] Resets a player’s daily missions.
/kivobppopup Turns the Claim All popup on or off for everyone until the resource restarts.
/kivobproll [id] Saves the player’s unclaimed rewards as carryover right away. Meant for testing. See Carryover.
/kivobptest <missionId> [id] Starts a mission for a player and moves the player to its test location.

Examples:

/kivobpxp 12 5000
/kivobptier 12 25
/kivobppremium 12
/kivobptest daily-2
/kivobptest weekly-3 12

/kivobpadmin opens an ox_lib menu with these entries. Each entry that needs a player asks for the player’s server id first.

Entry What it does
Create quest Opens the quest creator.
Give XP Gives XP to a player. Asks for the player id and the amount.
Set tier Sets a player’s tier. Asks for the player id and the tier.
Grant premium Gives a player Premium.
Revoke premium Removes a player’s Premium.
Reset dailies Resets a player’s daily missions.
Toggle Claim All popup Turns the Claim All popup on or off.
Force season rollover Saves a player’s unclaimed rewards as carryover. Same as /kivobproll.
Test mission Starts a mission for a player and moves the player to its test location. Asks for the player id and the mission id, for example daily-2.

The menu texts come from the admin. keys in the locale files. See Configuration.

When the Admin webhook is set, giving XP from the admin menu posts a message to it, and so does switching Premium on or off. See Webhooks.

Using the admin actions from your own admin menu

Section titled “Using the admin actions from your own admin menu”

The admin menu talks to the server through two ox_lib callbacks that are defined in open/admin.lua. You can call them from your own client code. The caller must pass the admin check described above.

-- Give player 12 5000 XP
lib.callback.await('kivo-battlepass:adminAction', false, 'xp', { target = 12, value = 5000 })
-- Set player 12 to tier 25
lib.callback.await('kivo-battlepass:adminAction', false, 'tier', { target = 12, value = 25 })
-- Grant Premium to player 12
lib.callback.await('kivo-battlepass:adminAction', false, 'premium', { target = 12 })

kivo-battlepass:adminAction takes an action name and a data table. It returns true when the action ran and false when it did not.

Action Data Effect
'xp' target, value Gives XP.
'tier' target, value Sets the tier.
'premium' target Grants Premium.
'revokepremium' target Revokes Premium.
'resetdaily' target Resets daily missions.
'popup' none Toggles the Claim All popup.
'rollover' target Saves unclaimed rewards as carryover.
'testmission' target, missionId Starts a mission and moves the player to its test location.

target is a player server id. When it is left out, the player who made the call is used.

kivo-battlepass:createQuest creates a mission. It takes one table with the fields period ('daily' or 'weekly'), questType, title, description, required, xpReward and params, and returns true when the mission was created.

To run the same actions from server code, use the exports.

Next: Exports and bridge files.