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.
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)) endend)Call exports from an event handler or a thread (CreateThread): some of them wait for the Fiveops cloud.
Return value
Section titled “Return value”| Field | Value |
|---|---|
ok | true or false |
data | The result when ok is true (see the tables below) |
error | Error code when ok is false |
detail | Extra information about the error; can be nil |
error | Meaning |
|---|---|
player_not_found | The player isn’t on the server or the character doesn’t exist. |
invalid_args | A parameter is missing or wrong; detail names it. |
unsupported | Your framework or scripts don’t support this (e.g. no ox_inventory). |
framework | The framework refused the change. |
cloud | The Fiveops cloud didn’t accept it. |
not_found | Nothing matched (e.g. no announcement recipients). |
rate_limited | Sent too often; wait and try again. |
session_error | Staff 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. |
internal | Unexpected error; the server console shows export … error. |
Who did it
Section titled “Who did it”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.
performedBy | The log shows |
|---|---|
| Player server ID (number) | That player with full identity (account, character, Discord) |
| Text | That name |
{ name = '…', discordId = '…' } | The name and Discord account |
nil | Only the resource name |
Failed actions are logged too, with the reason. Reading players or staff isn’t logged.
Reading
Section titled “Reading”| Export | Parameters | data |
|---|---|---|
getPlayers() | — | List of online players |
getPlayer(target) | Server ID, or citizenId (text) for an offline character | One 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, heal | true 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.
Actions
Section titled “Actions”| Export | Parameters | data |
|---|---|---|
kick(target, reason, performedBy) | Server ID; reason is required | true |
ban(target, reason, duration, performedBy) | Server ID or citizenId; duration in seconds, 0 is permanent | The ban record (id, reason, expiresAt) |
revive(target, performedBy) | Server ID | { framework }: false if only the game revive ran |
heal(target, performedBy) | Server ID | true |
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 found | true |
giveItem(target, item, count, metadata, performedBy) | Server ID or citizenId; ox_inventory item name; count defaults to 1; metadata optional | true |
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 grade | true |
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.
Announcement card
Section titled “Announcement card”exports.fiveops:announce({ title = 'Server restart', text = 'The server restarts in 10 minutes.', style = 'warning', target = { kind = 'all' },}, 'Restart bot')| Field | Value |
|---|---|
text | Required, up to 500 characters |
title | Optional, up to 64 characters |
style | announce (default), info, event, warning, urgent |
seconds | 4–45, default 10 |
sound | false to mute |
signature | none (default), role or name of performedBy |
target | Who sees it; default everyone |
target | Recipients |
|---|---|
{ 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.
Server events
Section titled “Server events”Listen with AddEventHandler in a server script.
| Event | Arguments |
|---|---|
fiveops:characterDeleted | citizenId, { id, name, via, batch } |
fiveops:characterRestored | citizenId, { id, name } |
fiveops:charactersDeleted | Batch 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.