Exports
Exports allow you to extend and integrate 919Admin Pro functionality from external scripts.
GetPlayerPermissionGroup
Server-side
exports.amzn_admin:GetPlayerPermissionGroup(source)Returns the permission group assigned to a player in the admin panel, or "User" if they have no access.
Parameters
| Name | Type | Description |
|---|---|---|
source |
number |
Player server ID |
Returns
"User"— player has no admin accessstring— the name of their assigned permission group
Example
if exports.amzn_admin:GetPlayerPermissionGroup(source) ~= 'User' then
-- Player has admin access
else
lib.notify(source, { title = 'You do not have access!', type = 'error' })
endCreateBan
Server-side
exports.amzn_admin:CreateBan(data)Registers a ban in the admin menu from an external script.
Parameters
data is a table with the following fields:
| Name | Type | Required | Description |
|---|---|---|---|
source |
number |
No | Player server ID |
license |
string |
No | Rockstar license identifier (e.g. "license:abcd") |
citizenId |
string |
No | Framework character identifier |
playerName |
string |
No | Player name, if not derivable from source |
reason |
string |
Yes | Reason for the ban |
durationMinutes |
number |
No | Ban length in minutes. Use -1 for permanent |
issuedBy |
string |
No | Name of the script or admin issuing the ban |
Examples
-- Ban by source
exports.amzn_admin:CreateBan({
source = src,
reason = 'Cheating',
durationMinutes = 60,
issuedBy = 'AntiCheat'
})
-- Ban by license
exports.amzn_admin:CreateBan({
license = 'license:abcd',
playerName = 'John Doe',
reason = 'RDM',
durationMinutes = -1
})
-- Ban by citizenId
exports.amzn_admin:CreateBan({
citizenId = 'ABC123',
reason = 'VDM',
durationMinutes = 1440,
issuedBy = 'MyScript'
})SetPlayerPermissionGroup
Server-side
exports.amzn_admin:SetPlayerPermissionGroup(source, adminMenuPermName, temporary)Sets a player's permission group, either temporarily (cache only) or persistently (database + cache).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
source |
number |
Yes | Player server ID |
adminMenuPermName |
string |
Yes | An existing 919Admin permission group name, or the built-in "SuperAdmin" |
temporary |
boolean |
No | true = cache only, cleared on disconnect. false/nil = saved to admin_users table |
Returns
trueon successfalse, errorMessageon failure (invalid parameters, group doesn't exist, DB error, etc.)
Examples
-- Temporary group (cache only)
exports.amzn_admin:SetPlayerPermissionGroup(source, 'Moderator', true)
-- Persistent group (saved to DB)
exports.amzn_admin:SetPlayerPermissionGroup(source, 'Admin', false)
-- Built-in SuperAdmin
exports.amzn_admin:SetPlayerPermissionGroup(source, 'SuperAdmin')RemovePlayerPermissionGroup
Server-side
exports.amzn_admin:RemovePlayerPermissionGroup(source)Removes a player's permission group entirely, deleting any persistent record and clearing the cache. The player will be treated as a default "User" after this call.
Parameters
| Name | Type | Description |
|---|---|---|
source |
number |
Player server ID |
Returns
trueon successfalse, errorMessageon failure (invalid parameters, missing license, etc.)
Example
local ok, err = exports.amzn_admin:RemovePlayerPermissionGroup(source)
if not ok then
print(('[MyResource] Failed to remove admin group: %s'):format(err))
end