Skip to content

Developer exports

Your server scripts can call Fiveops with exports.fiveops:<name>(…). Actions take the same path as the web panel and are written to the Fiveops log. Exports are server-side only.

my_admin/server.lua
RegisterNetEvent('my_admin:revive', function(target)
local src = source
local allowed = exports.fiveops:hasPermission(src, 'revive')
if not (allowed.ok and allowed.data) then return end
local result = exports.fiveops:revive(target, src)
if not result.ok then
print(('revive failed: %s'):format(result.error))
end
end)

Call exports from an event handler or a thread (CreateThread): some of them wait for the Fiveops cloud.

FieldValue
oktrue or false
dataThe result when ok is true (see the tables below)
errorError code when ok is false
detailExtra information about the error; can be nil
errorMeaning
player_not_foundThe player isn’t on the server or the character doesn’t exist.
invalid_argsA parameter is missing or wrong; detail names it.
unsupportedYour framework or scripts don’t support this (e.g. no ox_inventory).
frameworkThe framework refused the change.
cloudThe Fiveops cloud didn’t accept it.
not_foundNothing matched (e.g. no announcement recipients).
rate_limitedSent too often; wait and try again.
session_errorStaff details couldn’t be fetched from Fiveops right now. With detail session_pending the call came from outside a thread and couldn’t wait: call it inside CreateThread.
internalUnexpected error; the server console shows export … error.

The last parameter of every action is performedBy (optional). The Fiveops log always shows the resource that called the export; performedBy adds who did it.

performedByThe log shows
Player server ID (number)That player with full identity (account, character, Discord)
TextThat name
{ name = '…', discordId = '…' }The name and Discord account
nilOnly the resource name

Failed actions are logged too, with the reason. Reading players or staff isn’t logged.

ExportParametersdata
getPlayers()—List of online players
getPlayer(target)Server ID, or citizenId (text) for an offline characterOne player, plus cash, bank and identifiers (never IP)
getStaff(src)Server ID{ staff = false } or { staff = true, role, title, permissions }
hasPermission(src, permission)Server ID, permission key such as kick, ban, revive, healtrue or false; owner and admin roles have every permission

Player fields: id, online, name (character), account, citizenId, discordId, job = { name, label, grade, gradeLabel, isBoss, onDuty }, gang, state (alive, down, dead), frozen, staff, staffTitle. An offline character has online = false and lastSeen instead of id.

ExportParametersdata
kick(target, reason, performedBy)Server ID; reason is requiredtrue
ban(target, reason, duration, performedBy)Server ID or citizenId; duration in seconds, 0 is permanentThe ban record (id, reason, expiresAt)
revive(target, performedBy)Server ID{ framework }: false if only the game revive ran
heal(target, performedBy)Server IDtrue
freeze(target, state, performedBy)Server ID; state = false unfreezes{ frozen }
teleport(target, coords, performedBy)Server ID; vector3 or { x, y, z }; without z the ground is foundtrue
giveItem(target, item, count, metadata, performedBy)Server ID or citizenId; ox_inventory item name; count defaults to 1; metadata optionaltrue
giveMoney(target, account, amount, performedBy)Server ID or citizenId; account is cash or bank{ cash, bank }
setJob(target, job, grade, performedBy)Server ID or citizenId; job name and gradetrue
announce(card, performedBy)See below{ id, count }: count is the number of recipients

A citizenId target works offline when your framework supports it, just like in the panel.

exports.fiveops:announce({
title = 'Server restart',
text = 'The server restarts in 10 minutes.',
style = 'warning',
target = { kind = 'all' },
}, 'Restart bot')
FieldValue
textRequired, up to 500 characters
titleOptional, up to 64 characters
styleannounce (default), info, event, warning, urgent
seconds4–45, default 10
soundfalse to mute
signaturenone (default), role or name of performedBy
targetWho sees it; default everyone
targetRecipients
{ kind = 'all' }Everyone
{ kind = 'players', ids = { 3, 12 } }These server IDs
{ kind = 'staff' }Staff in game
{ kind = 'job', name = 'police', grades = { 2 }, duty = true }A job; grades and duty optional
{ kind = 'gang', name = 'ballas' }A gang
{ kind = 'state', states = { 'dead', 'down' } }Players in these states
{ kind = 'radius', center = 12, meters = 50 }Around a player (10–2000 m)
{ kind = 'role', roleId = '…' }Holders of a Discord role

The same limit as the menu applies: one announcement every 8 seconds per sender and 6 per minute server-wide.

Listen with AddEventHandler in a server script.

EventArguments
fiveops:characterDeletedcitizenId, { id, name, via, batch }
fiveops:characterRestoredcitizenId, { id, name }
fiveops:charactersDeletedBatch ID, { total, ok, failed, skipped, via, ref }

exports.fiveops:emit('staff.action', { actor = 'Atlas', action = 'jail' }) counts an action of your own script in the panel’s staff activity (actor and action required, up to 64 characters; target and meta optional). It isn’t written to the Fiveops log.