Admin Panel

Exports

Use the admin panel from your own resources: society money, staff checks, bans, logs, alerts, tools and inventories.

View in store

Society (job money)

With Config.Bridge.Society = 'builtin' lg_admin keeps the money of every job itself (a job that was never used has $0, Config.Society.Min / Max limit the balance). The same exports work with every other supported banking script, so your scripts can use one API for all of them.

ServerExport

GetSocietyMoney

Balance of a job.

What you pass

  • jobstring

    Job name, e.g. 'police'.

What you get back

  • balancenumber

Example

Lua
local money = exports.lg_admin:GetSocietyMoney('police')
ServerExport

AddSocietyMoney

Adds money to a job.

What you pass

  • jobstring
  • amountnumber

    More than 0.

  • reasonstringoptional

    Shown in the money log.

What you get back

  • okboolean
  • resultnumber | string

    New balance, or why it failed: 'min', 'max', 'bad_amount', 'bad_job'.

Example

Lua
local ok, balance = exports.lg_admin:AddSocietyMoney('police', 5000, 'Fines')
ServerExport

RemoveSocietyMoney

Removes money from a job.

What you pass

  • jobstring
  • amountnumber
  • reasonstringoptional

What you get back

  • okboolean
  • resultnumber | string

    New balance or the reason.

Example

Lua
exports.lg_admin:RemoveSocietyMoney('police', 2500, 'New radios')
ServerExport

SetSocietyMoney

Sets an exact balance.

What you pass

  • jobstring
  • amountnumber
  • reasonstringoptional

What you get back

  • okboolean
  • resultnumber | string
ServerExport

HasSocietyMoney

True when the job has at least this much.

What you pass

  • jobstring
  • amountnumber

What you get back

  • enoughboolean

Example

Lua
if exports.lg_admin:HasSocietyMoney('mechanic', 1500) then ... end
ServerExport

TransferSocietyMoney

Moves money from one job to another. Nothing moves when it is refused (limits are checked first).

What you pass

  • fromJobstring
  • toJobstring
  • amountnumber
  • reasonstringoptional

What you get back

  • okboolean
  • fromBalancenumber | string

    New balance of the first job, or the reason.

  • toBalancenumber

Example

Lua
exports.lg_admin:TransferSocietyMoney('police', 'ambulance', 10000, 'Shared equipment')
ServerExport

GetAllSocieties

Every job with money, richest first.

What you pass

Nothing.

What you get back

  • listtable

    { { job, label, balance } }

ServerExport

GetSocietyTransactions

The money log of a job, newest first.

What you pass

  • jobstring
  • limitnumberoptional

    1 - 200, default 50.

What you get back

  • listtable

    { { id, amount, balance, kind, actor, resource, reason, at } }

ServerExport

GetSocietySystem

The society system in use.

What you pass

Nothing.

What you get back

  • systemstring

    'builtin', 'qb-banking', 'okokBanking' ...

Staff and permissions

ServerExport

IsStaff

True when the player has any staff role.

What you pass

  • srcnumber

What you get back

  • staffboolean
ServerExport

IsOwner

True for owners (ServerConfig.Owners).

What you pass

  • srcnumber

What you get back

  • ownerboolean
ServerExport

HasPermission

Checks one permission node.

What you pass

What you get back

  • allowedboolean

Example

Lua
if not exports.lg_admin:HasPermission(source, 'players.revive') then return end
ServerExport

GetStaff

The staff role of a player.

What you pass

  • srcnumber

What you get back

  • stafftable | nil

    { role, label, color, priority, owner, permissions, sources }

ServerExport

GetOnlineStaff

Every staff member online, once each (website staff included). game = in the game (id is their server id), web = has the website open.

What you pass

Nothing.

What you get back

  • listtable

    { { id, name, role, label, color, priority, game, web } }

ServerExport

CanTarget

True when src outranks target (or the target is not staff).

What you pass

  • srcnumber
  • targetnumber

What you get back

  • allowedboolean
ServerExport

GetPermissionNodes

Every permission, grouped.

What you pass

Nothing.

What you get back

  • groupstable

    { { group, nodes } }

ServerExport

RegisterPermissions

Adds a permission group from another resource (used by LegendScripts scripts like LG Queue). It shows in the role editor like every other group and is removed when that resource stops. Built-in permissions cannot be taken over.

What you pass

  • groupIdstring

    Letters, numbers and _

  • nodestable

    e.g. { 'queue.view', 'queue.points' }

  • labelstable

    { group = 'Queue', ['queue.view'] = 'Open the queue panel' }

What you get back

  • okboolean

Example

Lua
exports.lg_admin:RegisterPermissions('queue', { 'queue.view' }, { group = 'Queue', ['queue.view'] = 'Open the queue panel' })
ServerExport

RegisterPage

Adds a page of another resource under Scripts in the side menu. In the game it opens that resource's own page inside the panel; on the website it shows a button to webUrl.

What you pass

  • idstring
  • datatable

    { label, icon, url = 'nui://resource/page.html', webUrl, permission }

What you get back

  • okboolean
ServerExport

HasPermissionByDiscord

Checks a permission for someone who is not in the game (a website or Discord bot of another script), with the same roles: owner, added staff and Discord roles.

What you pass

  • discordIdstring
  • nodestring

What you get back

  • allowedboolean

Moderation

ServerExport

BanPlayer

Bans a player. Online bans take every identifier and hardware token the player has.

What you pass

  • targetnumber | string | table

    Server id, an identifier, or a list of identifiers (offline).

  • reasonstring
  • hoursnumber

    0 = permanent.

  • bystringoptional

    Name saved as "who did it". Default: your resource name.

What you get back

  • okboolean
  • messagestring
  • banIdnumber

Example

Lua
exports.lg_admin:BanPlayer(source, 'Speed hack', 0, 'MyAnticheat')
ServerExport

UnbanPlayer

Lifts a ban.

What you pass

  • banIdnumber
  • bystringoptional

    Name saved as "who did it". Default: your resource name.

What you get back

  • okboolean
  • messagestring

    Result text (or the reason it failed).

ServerExport

IsBanned

Checks a player against the active bans.

What you pass

  • targetnumber | string

    Server id of an online player, or an identifier such as 'license:...' / 'discord:...'.

What you get back

  • banfalse | table

    { id, reason, by, createdAt, expiresAt }

ServerExport

GetBans

Active bans that match the player.

What you pass

  • targetnumber | string

    Server id of an online player, or an identifier such as 'license:...' / 'discord:...'.

What you get back

  • listtable

    { { id, reason, expiresAt } }

ServerExport

KickPlayer

Kicks an online player.

What you pass

  • srcnumber
  • reasonstring
  • bystringoptional

    Name saved as "who did it". Default: your resource name.

What you get back

  • okboolean
  • messagestring

    Result text (or the reason it failed).

ServerExport

WarnPlayer

Warns an online player (they see the warning on screen).

What you pass

  • srcnumber
  • reasonstring
  • bystringoptional

    Name saved as "who did it". Default: your resource name.

What you get back

  • okboolean
  • messagestring

    Result text (or the reason it failed).

ServerExport

GetWarnings

Warnings of a player.

What you pass

  • targetnumber | string

    Server id of an online player, or an identifier such as 'license:...' / 'discord:...'.

What you get back

  • listtable

    { { id, reason, by, at } }

ServerExport

AddNote

Adds a staff note to the player profile.

What you pass

  • targetnumber | string

    Server id of an online player, or an identifier such as 'license:...' / 'discord:...'.

  • textstring
  • bystringoptional

    Name saved as "who did it". Default: your resource name.

What you get back

  • okboolean
  • messagestring

    Result text (or the reason it failed).

ServerExport

GetNotes

Staff notes of a player.

What you pass

  • targetnumber | string

    Server id of an online player, or an identifier such as 'license:...' / 'discord:...'.

What you get back

  • listtable

    { { id, text, by, at } }

ServerExport

AddToWatchlist

Adds a player to the watchlist (staff get an alert when they join).

What you pass

  • targetnumber | string

    Server id of an online player, or an identifier such as 'license:...' / 'discord:...'.

  • reasonstring
  • bystringoptional

    Name saved as "who did it". Default: your resource name.

What you get back

  • okboolean
  • messagestring

    Result text (or the reason it failed).

ServerExport

RemoveFromWatchlist

Removes a player from the watchlist.

What you pass

  • targetnumber | string

    Server id of an online player, or an identifier such as 'license:...' / 'discord:...'.

  • bystringoptional

    Name saved as "who did it". Default: your resource name.

What you get back

  • okboolean
  • messagestring

    Result text (or the reason it failed).

ServerExport

IsWatched

Checks the watchlist.

What you pass

  • targetnumber | string

    Server id of an online player, or an identifier such as 'license:...' / 'discord:...'.

What you get back

  • entryfalse | table

    { reason, by, at, name }

ServerExport

HasPunishment

True while the player has this timed punishment.

What you pass

  • srcnumber
  • kindstring

    e.g. 'noweapons', 'jail' or the id of a custom punishment.

What you get back

  • activeboolean

Example

Lua
if exports.lg_admin:HasPunishment(source, 'chatmute') then return end
ServerExport

GetPunishments

Every punishment the player has right now.

What you pass

  • srcnumber

What you get back

  • listtable

    { { id, kind, label, remaining, reason, by } }

ServerExport

Punish

Gives a timed punishment from your script (logged with your resource name).

What you pass

  • srcnumber

    Online player.

  • kindstring
  • minutesnumber
  • reasonstringoptional
  • valuestableoptional

    e.g. { weapons = { 'WEAPON_PISTOL' } } or { speed = 50 }.

What you get back

  • okboolean
  • messagestring

    The result or why it failed.

Example

Lua
exports.lg_admin:Punish(source, 'noweapons', 30, 'Anticheat: weapon spawn')

Logs, alerts and staff messages

ServerExport

AddLog

Writes a log line in the category "Other scripts" (Discord webhook scripts, or admin when empty).

What you pass

  • titlestring

    The log title.

  • datatableoptional

    Simple fields (text, numbers, true / false) shown in the log details.

  • targetnumber | stringoptional

    The player it is about.

What you get back

  • okboolean

Example

Lua
exports.lg_admin:AddLog('Fleeca robbery started', { bank = 'Legion Square', cops = 4 }, source)
ServerExport

SendAlert

A pop-up alert for staff with alerts.view (also on the dashboard and in the log).

What you pass

  • targetnumberoptional

    The player it is about (or nil).

  • textstring
  • datatableoptional

    Extra fields.

What you get back

  • okboolean

Example

Lua
exports.lg_admin:SendAlert(source, 'Bought 40 lockpicks in one minute')
ServerExport

NotifyStaff

An in-game notification to every online staff member.

What you pass

  • textstring
  • kindstringoptional

    'info', 'success', 'warning', 'error'.

  • permissionstringoptional

    Only staff with this permission.

What you get back

  • sentnumber

    How many got it.

ServerExport

SendStaffMessage

Posts a message in the staff chat.

What you pass

  • textstring
  • namestringoptional

    Shown as the author. Default: your resource name.

What you get back

  • okboolean
ServerExport

CreateReport

Opens a report for a player (same rules as /report).

What you pass

  • srcnumber
  • subjectstring
  • messagestring
  • categorystringoptional

    One of Config.Reports.Categories.

What you get back

  • okboolean
  • messagestring

    Result text (or the reason it failed).

ServerExport

GetOpenReportCount

Number of reports that are not closed.

What you pass

Nothing.

What you get back

  • countnumber
ServerExport

Announce

Server announcement.

What you pass

  • textstring
  • secondsnumberoptional
  • stylestringoptional

    'banner' or 'toast'.

What you get back

  • okboolean
  • messagestring

    Result text (or the reason it failed).

Players and tools

ServerExport

GetPlaytime

Seconds played (saved time plus the current session).

What you pass

  • targetnumber | string

    Server id of an online player, or an identifier such as 'license:...' / 'discord:...'.

What you get back

  • secondsnumber
ServerExport

GetToolStates

Which staff tools a player has on.

What you pass

  • srcnumber

What you get back

  • statestable

    { noclip, godmode, invisible, superjump, names, esp, inspector }

ServerExport

IsInNoclip

True while the player is in noclip - for anticheats.

What you pass

  • srcnumber

What you get back

  • noclipboolean

Example

Lua
if exports.lg_admin:IsInNoclip(source) then return end -- do not flag staff
ServerExport

IsInvisible

True while invisible.

What you pass

  • srcnumber

What you get back

  • invisibleboolean
ServerExport

IsGodmode

True while god mode is on.

What you pass

  • srcnumber

What you get back

  • godmodeboolean
ServerExport

RevivePlayer

Revives a player through your ambulance script.

What you pass

  • targetnumber | string

    Server id of an online player, or an identifier such as 'license:...' / 'discord:...'.

What you get back

  • okboolean
ServerExport

HealPlayer

Heals a player.

What you pass

  • targetnumber | string

    Server id of an online player, or an identifier such as 'license:...' / 'discord:...'.

What you get back

  • okboolean
ServerExport

CreateBackup

Saves a character backup.

What you pass

  • targetnumber | string

    Server id or character id.

  • reasonstringoptional

What you get back

  • idnumber | nil

    Backup id.

ServerExport

GetDiscord

Discord profile of a player (needs the bot).

What you pass

  • targetnumber | string

    Server id of an online player, or an identifier such as 'license:...' / 'discord:...'.

What you get back

  • profiletable | nil

    { id, name, username, nick, avatar, roles, roleIds }

ServerExport

SearchInventories

The search of the Inventories page.

What you pass

  • optionstable

    { item, min, search, kind, page } - kind: 'all', 'player', 'vehicle', 'stash'.

What you get back

  • resulttable

    { results, total, sum, pages }

Example

Lua
local r = exports.lg_admin:SearchInventories({ item = 'money', min = 100000 })
print(('%d places hold %d money'):format(r.total, r.sum))

Client exports

ClientExport

IsPanelOpen

True while the admin panel is open.

What you pass

Nothing.

What you get back

  • openboolean

Example

Lua
if exports.lg_admin:IsPanelOpen() then return end
ClientExport

IsQuickMenuOpen

True while the quick menu is open.

What you pass

Nothing.

What you get back

  • openboolean
ClientExport

IsStaff

True when the local player is staff.

What you pass

Nothing.

What you get back

  • staffboolean
ClientExport

HasPermission

Checks a permission of the local player.

What you pass

  • nodestring

What you get back

  • allowedboolean
ClientExport

GetStaffRole

The local player's role.

What you pass

Nothing.

What you get back

  • roletable | nil

    { role, label, color, priority }

ClientExport

GetToolStates

Staff tools of the local player.

What you pass

Nothing.

What you get back

  • statestable
ClientExport

IsInNoclip

True while in noclip.

What you pass

Nothing.

What you get back

  • noclipboolean
ClientExport

IsInvisible

True while invisible.

What you pass

Nothing.

What you get back

  • invisibleboolean
ClientExport

IsGodmode

True while god mode is on.

What you pass

Nothing.

What you get back

  • godmodeboolean
ClientExport

IsSpectating

True while spectating, and who.

What you pass

Nothing.

What you get back

  • spectatingboolean
  • targetnumber

    Server id.

ClientExport

HasPunishment

True while the local player has this punishment.

What you pass

  • kindstring

What you get back

  • activeboolean

Example

Lua
if exports.lg_admin:HasPunishment('noweapons') then return end
ClientExport

GetNoclipPosition

Camera position while in noclip.

What you pass

Nothing.

What you get back

  • coordsvector3 | nil
ClientExport

SetTool

Turns a staff tool on or off (needs its permission).

What you pass

  • namestring

    'noclip', 'godmode', 'invisible', 'superjump', 'names', 'esp', 'inspector'

  • onboolean

What you get back

  • okboolean

Example

Lua
exports.lg_admin:SetTool('noclip', true)
ClientExport

OpenPanel

Opens the admin panel (staff only).

What you pass

Nothing.

What you get back

Nothing.

ClientExport

OpenQuickMenu

Opens the quick menu (staff only).

What you pass

Nothing.

What you get back

Nothing.

ClientExport

CloseMenus

Closes the panel and the quick menu.

What you pass

Nothing.

What you get back

Nothing.

ClientExport

OpenReports

Opens the player's report window (same as /report).

What you pass

Nothing.

What you get back

Nothing.

Last updated