fxManager
FXServer Integration

Player Exports

Reference guide for interacting with fxManager programmatically via server-side resource exports.

Methods for retrieving live connection data, searching historical player files, or querying specific player targets.

fetchPlayers

Retrieves an array of all active players currently initialized on the game server.

local result = exports.fxmanager:fetchPlayers()

if result.ok then
    for _, player in ipairs(result.data) do
        print("Active Player: " .. player.name)
    end
else
    print("Failed to fetch players: " .. result.error)
end

getPlayer

Looks up an individual player record based on a structured Target descriptor.

Parameters:

Prop

Type

-- Lookup via standard Server ID
local target = 14

-- Alternate: Lookup via license string
-- local target = { identifiers = { license = "license:xxxxxxxx" } }

local result = exports.fxmanager:getPlayer(target)

if result.ok then
    print("Found Player: " .. result.data.name .. " | Playtime: " .. result.data.playtime)
else
    print("Lookup failed: " .. result.error)
end

getSelf

Retrieves the administrative profile and permission data for a specific player based on their server ID.

Parameters:

Prop

Type

-- The server ID of the player
local playerId = 1

local result = exports.fxmanager:getSelf(playerId)

if result.ok then
    if result.data.isAdmin then
        print("Admin found: " .. tostring(result.data.username) .. " | Is Master: " .. tostring(result.data.isMaster))
    else
        print("Player is not an admin.")
    end
else
    print("Lookup failed: " .. result.error)
end

searchPlayers

Searches the entire historical player database using text match strings alongside pagination and sorting options.

Parameters:

Prop

Type

local opts = {
    page = 1,
    pageSize = 10,
    sortBy = 'playtime',
    sortOrder = 'desc'
}

local result = exports.fxmanager:searchPlayers("John", opts)

if result.ok then
    print("Found " .. #result.data .. " matches.")
end

addNote

Appends an administrative note to a player's file history. The invoking resource name is automatically captured in the background for auditing.

Parameters:

Prop

Type

local notePayload = {
    target = 42, -- Server ID
    content = "Player was warned for aggressive driving patterns.",
    by = 1       -- Admin Database ID
}

local result = exports.fxmanager:addNote(notePayload)

On this page