Admin Panel
Exports
Use the admin panel from your own resources: society money, staff checks, bans, logs, alerts, tools and inventories.
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.
GetSocietyMoney
Balance of a job.
What you pass
jobstringJob name, e.g.
'police'.
What you get back
balancenumber
Example
local money = exports.lg_admin:GetSocietyMoney('police')AddSocietyMoney
Adds money to a job.
What you pass
jobstringamountnumberMore than 0.
reasonstringoptionalShown in the money log.
What you get back
okbooleanresultnumber | stringNew balance, or why it failed:
'min','max','bad_amount','bad_job'.
Example
local ok, balance = exports.lg_admin:AddSocietyMoney('police', 5000, 'Fines')RemoveSocietyMoney
Removes money from a job.
What you pass
jobstringamountnumberreasonstringoptional
What you get back
okbooleanresultnumber | stringNew balance or the reason.
Example
exports.lg_admin:RemoveSocietyMoney('police', 2500, 'New radios')SetSocietyMoney
Sets an exact balance.
What you pass
jobstringamountnumberreasonstringoptional
What you get back
okbooleanresultnumber | string
HasSocietyMoney
True when the job has at least this much.
What you pass
jobstringamountnumber
What you get back
enoughboolean
Example
if exports.lg_admin:HasSocietyMoney('mechanic', 1500) then ... endTransferSocietyMoney
Moves money from one job to another. Nothing moves when it is refused (limits are checked first).
What you pass
fromJobstringtoJobstringamountnumberreasonstringoptional
What you get back
okbooleanfromBalancenumber | stringNew balance of the first job, or the reason.
toBalancenumber
Example
exports.lg_admin:TransferSocietyMoney('police', 'ambulance', 10000, 'Shared equipment')GetAllSocieties
Every job with money, richest first.
What you pass
Nothing.
What you get back
listtable{ { job, label, balance } }
GetSocietyTransactions
The money log of a job, newest first.
What you pass
jobstringlimitnumberoptional1 - 200, default 50.
What you get back
listtable{ { id, amount, balance, kind, actor, resource, reason, at } }
GetSocietySystem
The society system in use.
What you pass
Nothing.
What you get back
systemstring'builtin','qb-banking','okokBanking'...
Staff and permissions
IsStaff
True when the player has any staff role.
What you pass
srcnumber
What you get back
staffboolean
IsOwner
True for owners (ServerConfig.Owners).
What you pass
srcnumber
What you get back
ownerboolean
HasPermission
Checks one permission node.
What you pass
srcnumbernodestringSee Permissions.
What you get back
allowedboolean
Example
if not exports.lg_admin:HasPermission(source, 'players.revive') then return endGetStaff
The staff role of a player.
What you pass
srcnumber
What you get back
stafftable | nil{ role, label, color, priority, owner, permissions, sources }
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 } }
CanTarget
True when src outranks target (or the target is not staff).
What you pass
srcnumbertargetnumber
What you get back
allowedboolean
GetPermissionNodes
Every permission, grouped.
What you pass
Nothing.
What you get back
groupstable{ { group, nodes } }
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
groupIdstringLetters, numbers and _
nodestablee.g.
{ 'queue.view', 'queue.points' }labelstable{ group = 'Queue', ['queue.view'] = 'Open the queue panel' }
What you get back
okboolean
Example
exports.lg_admin:RegisterPermissions('queue', { 'queue.view' }, { group = 'Queue', ['queue.view'] = 'Open the queue panel' })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
idstringdatatable{ label, icon, url = 'nui://resource/page.html', webUrl, permission }
What you get back
okboolean
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
discordIdstringnodestring
What you get back
allowedboolean
Moderation
BanPlayer
Bans a player. Online bans take every identifier and hardware token the player has.
What you pass
targetnumber | string | tableServer id, an identifier, or a list of identifiers (offline).
reasonstringhoursnumber0 = permanent.
bystringoptionalName saved as "who did it". Default: your resource name.
What you get back
okbooleanmessagestringbanIdnumber
Example
exports.lg_admin:BanPlayer(source, 'Speed hack', 0, 'MyAnticheat')UnbanPlayer
Lifts a ban.
What you pass
banIdnumberbystringoptionalName saved as "who did it". Default: your resource name.
What you get back
okbooleanmessagestringResult text (or the reason it failed).
IsBanned
Checks a player against the active bans.
What you pass
targetnumber | stringServer id of an online player, or an identifier such as
'license:...'/'discord:...'.
What you get back
banfalse | table{ id, reason, by, createdAt, expiresAt }
GetBans
Active bans that match the player.
What you pass
targetnumber | stringServer id of an online player, or an identifier such as
'license:...'/'discord:...'.
What you get back
listtable{ { id, reason, expiresAt } }
KickPlayer
Kicks an online player.
What you pass
srcnumberreasonstringbystringoptionalName saved as "who did it". Default: your resource name.
What you get back
okbooleanmessagestringResult text (or the reason it failed).
WarnPlayer
Warns an online player (they see the warning on screen).
What you pass
srcnumberreasonstringbystringoptionalName saved as "who did it". Default: your resource name.
What you get back
okbooleanmessagestringResult text (or the reason it failed).
GetWarnings
Warnings of a player.
What you pass
targetnumber | stringServer id of an online player, or an identifier such as
'license:...'/'discord:...'.
What you get back
listtable{ { id, reason, by, at } }
AddNote
Adds a staff note to the player profile.
What you pass
targetnumber | stringServer id of an online player, or an identifier such as
'license:...'/'discord:...'.textstringbystringoptionalName saved as "who did it". Default: your resource name.
What you get back
okbooleanmessagestringResult text (or the reason it failed).
GetNotes
Staff notes of a player.
What you pass
targetnumber | stringServer id of an online player, or an identifier such as
'license:...'/'discord:...'.
What you get back
listtable{ { id, text, by, at } }
AddToWatchlist
Adds a player to the watchlist (staff get an alert when they join).
What you pass
targetnumber | stringServer id of an online player, or an identifier such as
'license:...'/'discord:...'.reasonstringbystringoptionalName saved as "who did it". Default: your resource name.
What you get back
okbooleanmessagestringResult text (or the reason it failed).
RemoveFromWatchlist
Removes a player from the watchlist.
What you pass
targetnumber | stringServer id of an online player, or an identifier such as
'license:...'/'discord:...'.bystringoptionalName saved as "who did it". Default: your resource name.
What you get back
okbooleanmessagestringResult text (or the reason it failed).
IsWatched
Checks the watchlist.
What you pass
targetnumber | stringServer id of an online player, or an identifier such as
'license:...'/'discord:...'.
What you get back
entryfalse | table{ reason, by, at, name }
HasPunishment
True while the player has this timed punishment.
What you pass
srcnumberkindstringe.g.
'noweapons','jail'or the id of a custom punishment.
What you get back
activeboolean
Example
if exports.lg_admin:HasPunishment(source, 'chatmute') then return endGetPunishments
Every punishment the player has right now.
What you pass
srcnumber
What you get back
listtable{ { id, kind, label, remaining, reason, by } }
Punish
Gives a timed punishment from your script (logged with your resource name).
What you pass
srcnumberOnline player.
kindstringminutesnumberreasonstringoptionalvaluestableoptionale.g.
{ weapons = { 'WEAPON_PISTOL' } }or{ speed = 50 }.
What you get back
okbooleanmessagestringThe result or why it failed.
Example
exports.lg_admin:Punish(source, 'noweapons', 30, 'Anticheat: weapon spawn')Logs, alerts and staff messages
AddLog
Writes a log line in the category "Other scripts" (Discord webhook scripts, or admin when empty).
What you pass
titlestringThe log title.
datatableoptionalSimple fields (text, numbers, true / false) shown in the log details.
targetnumber | stringoptionalThe player it is about.
What you get back
okboolean
Example
exports.lg_admin:AddLog('Fleeca robbery started', { bank = 'Legion Square', cops = 4 }, source)SendAlert
A pop-up alert for staff with alerts.view (also on the dashboard and in the log).
What you pass
targetnumberoptionalThe player it is about (or nil).
textstringdatatableoptionalExtra fields.
What you get back
okboolean
Example
exports.lg_admin:SendAlert(source, 'Bought 40 lockpicks in one minute')NotifyStaff
An in-game notification to every online staff member.
What you pass
textstringkindstringoptional'info','success','warning','error'.permissionstringoptionalOnly staff with this permission.
What you get back
sentnumberHow many got it.
SendStaffMessage
Posts a message in the staff chat.
What you pass
textstringnamestringoptionalShown as the author. Default: your resource name.
What you get back
okboolean
CreateReport
Opens a report for a player (same rules as /report).
What you pass
srcnumbersubjectstringmessagestringcategorystringoptionalOne of
Config.Reports.Categories.
What you get back
okbooleanmessagestringResult text (or the reason it failed).
GetOpenReportCount
Number of reports that are not closed.
What you pass
Nothing.
What you get back
countnumber
Announce
Server announcement.
What you pass
textstringsecondsnumberoptionalstylestringoptional'banner'or'toast'.
What you get back
okbooleanmessagestringResult text (or the reason it failed).
Players and tools
GetPlaytime
Seconds played (saved time plus the current session).
What you pass
targetnumber | stringServer id of an online player, or an identifier such as
'license:...'/'discord:...'.
What you get back
secondsnumber
GetToolStates
Which staff tools a player has on.
What you pass
srcnumber
What you get back
statestable{ noclip, godmode, invisible, superjump, names, esp, inspector }
IsInNoclip
True while the player is in noclip - for anticheats.
What you pass
srcnumber
What you get back
noclipboolean
Example
if exports.lg_admin:IsInNoclip(source) then return end -- do not flag staffIsInvisible
True while invisible.
What you pass
srcnumber
What you get back
invisibleboolean
IsGodmode
True while god mode is on.
What you pass
srcnumber
What you get back
godmodeboolean
RevivePlayer
Revives a player through your ambulance script.
What you pass
targetnumber | stringServer id of an online player, or an identifier such as
'license:...'/'discord:...'.
What you get back
okboolean
HealPlayer
Heals a player.
What you pass
targetnumber | stringServer id of an online player, or an identifier such as
'license:...'/'discord:...'.
What you get back
okboolean
CreateBackup
Saves a character backup.
What you pass
targetnumber | stringServer id or character id.
reasonstringoptional
What you get back
idnumber | nilBackup id.
GetDiscord
Discord profile of a player (needs the bot).
What you pass
targetnumber | stringServer 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 }
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
local r = exports.lg_admin:SearchInventories({ item = 'money', min = 100000 })
print(('%d places hold %d money'):format(r.total, r.sum))Client exports
IsPanelOpen
True while the admin panel is open.
What you pass
Nothing.
What you get back
openboolean
Example
if exports.lg_admin:IsPanelOpen() then return endIsQuickMenuOpen
True while the quick menu is open.
What you pass
Nothing.
What you get back
openboolean
IsStaff
True when the local player is staff.
What you pass
Nothing.
What you get back
staffboolean
HasPermission
Checks a permission of the local player.
What you pass
nodestring
What you get back
allowedboolean
GetStaffRole
The local player's role.
What you pass
Nothing.
What you get back
roletable | nil{ role, label, color, priority }
GetToolStates
Staff tools of the local player.
What you pass
Nothing.
What you get back
statestable
IsInNoclip
True while in noclip.
What you pass
Nothing.
What you get back
noclipboolean
IsInvisible
True while invisible.
What you pass
Nothing.
What you get back
invisibleboolean
IsGodmode
True while god mode is on.
What you pass
Nothing.
What you get back
godmodeboolean
IsSpectating
True while spectating, and who.
What you pass
Nothing.
What you get back
spectatingbooleantargetnumberServer id.
HasPunishment
True while the local player has this punishment.
What you pass
kindstring
What you get back
activeboolean
Example
if exports.lg_admin:HasPunishment('noweapons') then return endGetNoclipPosition
Camera position while in noclip.
What you pass
Nothing.
What you get back
coordsvector3 | nil
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
exports.lg_admin:SetTool('noclip', true)OpenPanel
Opens the admin panel (staff only).
What you pass
Nothing.
What you get back
Nothing.
OpenQuickMenu
Opens the quick menu (staff only).
What you pass
Nothing.
What you get back
Nothing.
CloseMenus
Closes the panel and the quick menu.
What you pass
Nothing.
What you get back
Nothing.
OpenReports
Opens the player's report window (same as /report).
What you pass
Nothing.
What you get back
Nothing.
Last updated