### Initialize Workspace Source: https://fxmanager.dev/docs/development Commands to clone the repository and install dependencies using Bun. ```bash # Clone the workspace repository git clone https://github.com/fxManagerProject/fxManager.git cd fxManager # Install package nodes via Bun bun install ``` -------------------------------- ### Verify Installation Directory Structure Source: https://fxmanager.dev/docs/installation Displays the required file hierarchy for the fxManager installation folder. Ensure the public directory remains in the same location as the executable to avoid path resolution errors. ```text your-install-folder/ ├── fxmanager-windows.exe (or fxmanager-linux) ├── public/ <-- Critical front-end assets └── .env <-- optional ``` -------------------------------- ### Launch Development Mode Source: https://fxmanager.dev/docs/development Command to start the full reactive orchestration workspace. ```bash bun run dev ``` -------------------------------- ### Run NUI Development Server Source: https://fxmanager.dev/docs/development Starts the localized Vite dev server for the NUI front-end UI. ```bash bun run web:dev ``` -------------------------------- ### Implement searchBans Source: https://fxmanager.dev/docs/fxserver/moderation Examples of how to call the searchBans function and handle the returned result in Lua and JavaScript. ```lua local query = "Andreutu" local options = { page = 1; pageSize = 5; } local result = exports.fxmanager:searchBans(query, options) if result.ok then for _, ban in ipairs(result.data) do print("Ban (".. ban.id ..") Player: " .. ban.name .. " - " .. ban.reason) end else print("Failed to searcg for bans: " .. result.error) end ``` ```js const query = "discord:226389308305702912"; const options = { page: 1, pageSize: 5, }; const result = await exports.fxmanager:searchBans(query, options); if (result.ok) { result.data.forEach(({ id, name, reason }) => console.log(`Ban: (${id}) Player: ${name} - ${reason}`) ); } else { console.error(`Failed to search for bans: ${result.error}`); } ``` -------------------------------- ### Invoke addNote via Exports Source: https://fxmanager.dev/docs/fxserver/player Examples of calling the addNote export in Lua and JavaScript environments. ```lua 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) ``` ```js const notePayload = { target: 42, // Server ID content: "Player was warned for aggressive driving patterns.", by: 1, // Admin Database ID } const result = await exports.fxmanager.addNote(notePayload) ``` -------------------------------- ### getActionRecap Source: https://fxmanager.dev/docs/fxserver/audit Get the last actions made by an admin. ```APIDOC ## getActionRecap ### Description Get the last actions made by an admin. ### Parameters - **page** (number) - Optional - The page number to retrieve - **pageSize** (number) - Optional - The number of actions to retrieve per page - **serverId** (string) - Required - The server ID of the connected Admin/Staff member (or use the adminId) - **adminId** (string) - Optional - The database ID of the Admin/Staff (or use the serverId) ``` -------------------------------- ### Execute the Core Binary Source: https://fxmanager.dev/docs/installation Commands to set permissions and launch the fxManager executable on Linux or Windows systems. ```bash # On Linux chmod +x fxmanager-linux ./fxmanager-linux # On Windows fxmanager-windows.exe ``` -------------------------------- ### Deploy Resource Bundle Source: https://fxmanager.dev/docs/development Compiles the bundle and pushes it to the path defined in the DEPLOY_PATH environment variable. ```bash bun run deploy ``` -------------------------------- ### Compile Project Binaries Source: https://fxmanager.dev/docs/development Use these commands to trigger the build pipeline and generate platform-specific binaries. ```bash bun run build # Compiles both target profiles via Turbo caching engines bun run build --target=windows # Compiles the Windows target profile bun run build --target=linux # Compiles the Linux target profile ``` -------------------------------- ### Inspect Database Tables Source: https://fxmanager.dev/docs/development Launches the localized database GUI engine for inspecting active datasets. ```bash bun run db:studio ``` -------------------------------- ### Implement Ban Export Source: https://fxmanager.dev/docs/fxserver/moderation Demonstrates how to invoke the ban export to restrict a player. ```lua local target = { serverId = 1 } local reason = "No reason provided" local expiresAt = nil local durationSeconds = nil local by = 1 local response = exports.fxManager:ban(target, reason, expiresAt, durationSeconds, by) if response.ok then print("Ban successful, banId:", response.data.banId) else print("Unable to ban:", response.error) end ``` ```ts const target = { serverId: 1 }; const reason = "No reason provided"; const expiresAt = null; const durationSeconds = null; const by = 1; const response = await exports.fxManager.ban(target, reason, expiresAt, durationSeconds, by); if (response.ok) { console.log("Ban successful, banId:", response.data.banId); } else { console.log("Unable to ban:", response.error); } ``` -------------------------------- ### Restart the server using serverRestart Source: https://fxmanager.dev/docs/fxserver/server Triggers a full stop and boot cycle for the server. Requires an optional admin ID. ```lua local by = 1 local response = exports.fxManager:serverRestart(by) if response.ok then print("Server restart command processed successfully.") else print("Failed to restart server:", response.error) end ``` ```js const by = 1; const response = await exports.fxManager.serverRestart(by); if (response.ok) { console.log("Server restart command processed successfully."); } else { console.error(`Failed to restart server: ${response.error}`); } ``` -------------------------------- ### View Distribution Directory Structure Source: https://fxmanager.dev/docs/development The output directory structure after a successful build process. ```text dist/ ├── fxmanager-linux ← Linux server binary ├── fxmanager-windows.exe ← Windows server binary ├── public/ ← Embedded web app assets (Must remain next to binary) └── resource/ ← FXServer asset (Drop into your server's resources/ folder) ``` -------------------------------- ### View Project Directory Structure Source: https://fxmanager.dev/docs/development Visual representation of the monorepo layout including apps and shared packages. ```text fxManager/ ├── apps/ │ ├── core/ # Process Manager & backend webserver │ ├── resource/ # FXServer game resource bridge │ └── webpanel/ # React SPA dashboard UI ├── packages/ │ ├── database/ # Drizzle ORM schemas & automated migration engine │ ├── shared/ # Universal enums, types, and utility wrappers │ └── ui/ # Shared React ShadCN components ``` -------------------------------- ### Retrieve Player Admin Data Source: https://fxmanager.dev/docs/fxserver/player Demonstrates how to call the getSelf export to check a player's administrative status and handle the response. ```lua -- 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 ``` ```js const playerId = 1; const result = exports.fxmanager.getSelf(playerId); if (result.ok) { if (result.data.isAdmin) { console.log(`Admin found: ${result.data.username} | Group: ${result.data.group?.name}`); } else { console.log("Player is not an admin."); } } else { console.error(`Lookup failed: ${result.error}`); } ``` -------------------------------- ### Implement RevokeBan Export Source: https://fxmanager.dev/docs/fxserver/moderation Demonstrates how to revoke an existing ban using its unique database ID. ```lua local banId = 42 local options = { by = 1 } local response = exports.fxManager:revokeBan(banId, options) if response.ok then print("Ban successfully revoked, banId:", response.data.banId) else print("Unable to revoke ban:", response.error) end ``` ```js const banId = 42; const options = { by: 1, }; const response = await exports.fxManager.revokeBan(banId, options); if (response.ok) { console.log("Ban successfully revoked, banId:", response.data.banId); } else { console.log("Unable to revoke ban:", response.error); } ``` -------------------------------- ### serverRestart Source: https://fxmanager.dev/docs/fxserver/server Triggers a complete cycle sequence of stopping and booting the server back up. ```APIDOC ## serverRestart ### Description Triggers a complete cycle sequence of stopping and booting the server back up. ### Parameters - **by** (number) - Optional - The database ID of the Admin/Staff member initiating the server restart. ### Usage Example ```lua local by = 1 local response = exports.fxManager:serverRestart(by) ``` ```js const by = 1; const response = await exports.fxManager.serverRestart(by); ``` ``` -------------------------------- ### Run Code Quality Validation Source: https://fxmanager.dev/docs/development Execute these commands to lint, format, and type-check the codebase before committing changes. ```bash bun run check # Runs Lint + Format + Code Fix optimizations (Recommended) bun run lint # Executes code pattern evaluations bun run format # Applies layout adjustments to project files bun run typecheck # Fires parallel type checks (tsc --noEmit) across the monorepo via Turbo ``` -------------------------------- ### exports.fxManager:whitelistAdd Source: https://fxmanager.dev/docs/fxserver/whitelist Adds a player identifier to the whitelist system. ```APIDOC ## whitelistAdd ### Description Adds a new entry to the whitelist for a specific identifier type and value. ### Parameters - **type** (string) - Required - The identifier scope classification (e.g., 'license', 'discord', 'steam'). - **value** (string) - Required - The target account string credential matching the scope type. - **by** (number) - Optional - The database ID of the Admin/Staff member authorizing the whitelist grant. ### Request Example { "type": "discord", "value": "226389308305702912", "by": 1 } ``` -------------------------------- ### Record an admin action with actionRecap Source: https://fxmanager.dev/docs/fxserver/audit Sends an action recap to the audit log. The label must be alphanumeric and include underscores only. ```lua local response = exports.fxmanager:actionRecap({ serverId = 1, label = 'example_action', target = nil, metadata = { key = 'value', key2 = 1234 }, }) if response.ok then print('Action recap sent successfully, id:' .. response.data.recapId) else print('Failed to send action recap') end ``` ```ts const response = await exports.fxmanager.actionRecap({ serverId: 1, label: 'example_action', target: null, metadata: { key: 'value', key2: 1234 }, }); if (response.ok) { console.log('Action recap sent successfully, id:', response.data.recapId); } else { console.log('Failed to send action recap'); } ``` -------------------------------- ### Listen to txAdmin playerBanned event Source: https://fxmanager.dev/docs/fxserver/txadmin-compat Demonstrates how to register an event handler for the playerBanned event across different languages supported by FXServer. ```lua AddEventHandler('txAdmin:events:playerBanned', function(data) print(data.author .. " banned " .. data.targetName .. " for: " .. data.reason) end) ``` ```js on('txAdmin:events:playerBanned', (data) => { const { author, targetName, reason } = data; console.log(`${author} banned ${targetName} for: ${reason}.`); }); ``` ```cs EventHandlers["txAdmin:events:playerBanned"] += new Action((data) { try { string author = data.author; string targetName = data.targetName; string reason = data.reason; Debug.WriteLine($"{author} banned {targetName} for: {reason}"); } catch (Exception ex) { Debug.WriteLine($"Error parsing event data: {ex.Message}"); } }); ``` -------------------------------- ### Execute Player Search Source: https://fxmanager.dev/docs/fxserver/player Demonstrates how to invoke the searchPlayers function with pagination and sorting options in Lua and JavaScript. ```lua 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 ``` ```js const opts = { page: 1, pageSize: 10, sortBy: 'playtime', sortOrder: 'desc', }; const result = await exports.fxmanager.searchPlayers("GamerName", opts); ``` -------------------------------- ### Stop the server using serverStop Source: https://fxmanager.dev/docs/fxserver/server Initiates a graceful shutdown of the server environment. Requires an optional admin ID. ```lua local by = 1 local response = exports.fxManager:serverStop(by) if response.ok then print("Server stop command processed successfully.") else print("Failed to stop server:", response.error) end ``` ```js const by = 1; const response = await exports.fxManager.serverStop(by); if (response.ok) { console.log("Server stop command processed successfully."); } else { console.error(`Failed to stop server: ${response.error}`); } ``` -------------------------------- ### Generate Database Migration Source: https://fxmanager.dev/docs/development Invokes the automation hook to generate a migration file after schema structure updates. ```bash bun run db:migrate ``` -------------------------------- ### serverStop Source: https://fxmanager.dev/docs/fxserver/server Gracefully shuts down the running server environment. ```APIDOC ## serverStop ### Description Gracefully shuts down the running server environment. ### Parameters - **by** (number) - Optional - The database ID of the Admin/Staff member initiating the server shutdown. ### Usage Example ```lua local by = 1 local response = exports.fxManager:serverStop(by) ``` ```js const by = 1; const response = await exports.fxManager.serverStop(by); ``` ``` -------------------------------- ### Add player to whitelist Source: https://fxmanager.dev/docs/fxserver/whitelist Adds a player to the whitelist using a specified identifier scope and value. ```lua local payload = { type = "discord", value = "226389308305702912", by = 1 } local response = exports.fxManager:whitelistAdd(payload) if response.ok then print("Player successfully added to the whitelist.") else print("Failed to add player to whitelist:", response.error) end ``` ```ts const payload = { type: "discord", value: "226389308305702912", by: 1, }; const response = await exports.fxManager.whitelistAdd(payload); if (response.ok) { console.log("Player successfully added to the whitelist."); } else { console.error(`Failed to add player to whitelist: ${response.error}`); } ``` -------------------------------- ### getSelf(playerId) Source: https://fxmanager.dev/docs/fxserver/player Retrieves the administrative profile and permission data for a specific player based on their server ID. ```APIDOC ## getSelf(playerId) ### Description Retrieves the administrative profile and permission data for a specific player based on their server ID. ### Parameters - **playerId** (number | string) - Required - The server ID of the player whose admin information is being requested. ### Response - **ok** (boolean) - Indicates if the request was successful. - **data** (object) - Contains admin details: isAdmin (boolean), isMaster (boolean), adminId (number | null), username (string | null), group (object | null), permissions (string[]). - **error** (string) - Error message if the request failed. ``` -------------------------------- ### Watch Resource Files Source: https://fxmanager.dev/docs/development Initiates an active watcher to rebuild compiled output binaries upon file updates. ```bash bun run watch ``` -------------------------------- ### Check Player Groups via Export and Native Source: https://fxmanager.dev/docs/fxserver/groups Verify if a player belongs to a specific group using the fxManager export or the native IS_PLAYER_ACE_ALLOWED function. ```lua -- using the export local hasGroup = exports.fxmanager:hasGroup(source, "moderator") -- using the native local hasGroup = IsPlayerAceAllowed(source, "fxmanager.groups.moderator") ``` ```js // using the export const hasGroup = exports.fxmanager.hasGroup(source, "moderator"); // using the native const hasGroup = IsPlayerAceAllowed(source, "fxmanager.groups.moderator"); ``` ```cs // using the export bool hasGroup = Exports["fxmanager"].hasGroup(source, "moderator"); // using the native bool hasGroup = API.IsPlayerAceAllowed(source.ToString(), "fxmanager.groups.moderator "); ``` -------------------------------- ### actionRecap Source: https://fxmanager.dev/docs/fxserver/audit Sends a recap of an action made by an admin to fxManager's audit log. ```APIDOC ## actionRecap ### Description Sends a recap of an action made by an admin to fxManager's audit log. ### Parameters - **serverId** (string) - Required - The server ID of the connected Admin/Staff member - **label** (string) - Required - The label of the action, has to only be alphanumeric and _ characters - **target** (Target) - Optional - One of the following target types: number (player's server ID), { serverId: number } (player's server ID), { playerId: number } (player's database ID), or { identifiers: { license: string } } (Rockstar license hashes) - **metadata** (object) - Optional - Additional metadata to include with the audit log entry as a key-value object ``` -------------------------------- ### getPlayer Source: https://fxmanager.dev/docs/fxserver/player Looks up an individual player record based on a structured Target descriptor. ```APIDOC ## getPlayer ### Description Looks up an individual player record based on a structured Target descriptor. ### Signature `exports.fxmanager:getPlayer(target)` ### Parameters - **target** (Target) - Required. One of: number (server ID), { serverId: number }, { playerId: number }, or { identifiers: { license: string } }. ### Response - **ok** (boolean) - Success status - **data** (object) - Player record containing id, name, playtime, identifiers, isStaff, firstSeen, lastSeen, serverId, ping, and health. - **error** (string) - Error message if ok is false. ``` -------------------------------- ### Check player permissions Source: https://fxmanager.dev/docs/fxserver/permissions Verify if a player has a specific permission using either the fxManager export or the native IsPlayerAceAllowed function. ```lua -- using the export local hasPermission = exports.fxmanager:hasPermission(source, "players.kick") -- using the native local hasPermission = IsPlayerAceAllowed(source, "fxmanager.players.kick") ``` ```js // using the export const hasPermission = exports.fxmanager.hasPermission(source, "players.kick"); // using the native const hasPermission = IsPlayerAceAllowed(source, "fxmanager.players.kick"); ``` ```cs // using the export bool hasPermission = Exports["fxmanager"].hasPermission(source, "players.kick"); // using the native bool hasPermission = API.IsPlayerAceAllowed(source.ToString(), "fxmanager.players.kick"); ``` -------------------------------- ### exports.fxmanager:recentBans(options) Source: https://fxmanager.dev/docs/fxserver/moderation Retrieves a list of recent bans with optional pagination support. ```APIDOC ## Method: exports.fxmanager:recentBans(options) ### Description Retrieves a list of recent bans. Supports pagination via an optional configuration object. ### Parameters - **options** (object) - Optional - Configuration object for pagination: - **page** (number) - Target page offset. - **pageSize** (number) - Total items returned per frame. ### Response - **ok** (boolean) - Indicates if the request was successful. - **data** (array) - List of ban objects if successful: - **id** (number) - Unique ban identifier. - **playerId** (number) - Player identifier. - **name** (string) - Player name. - **reason** (string) - Reason for the ban. - **issuer** (number|null) - ID of the issuer. - **createdAt** (Date) - Timestamp of creation. - **expiresAt** (Date|null) - Expiration timestamp. - **revokedAt** (Date|null) - Revocation timestamp. - **error** (string) - Error message if ok is false. ``` -------------------------------- ### exports.fxManager:kick Source: https://fxmanager.dev/docs/fxserver/moderation The kick function allows administrators to remove a player from the server by providing a target identifier, a reason, and the issuing admin's database ID. ```APIDOC ## exports.fxManager:kick ### Description Removes a player from the server based on the provided target, reason, and issuing administrator. ### Parameters - **target** (Target) - Required - The player to kick. Can be a number (server ID), or an object containing {serverId: number}, {playerId: number}, or {identifiers: {license: string}}. - **reason** (string) - Required - The reason or enforcement context for the kick. - **by** (number) - Required - The database ID of the Admin/Staff member issuing the kick. ### Response - **ok** (boolean) - Indicates if the kick was successful. - **error** (string) - Error message if the operation failed. ``` -------------------------------- ### addNote Source: https://fxmanager.dev/docs/fxserver/player Appends an administrative note to a player's file history. The invoking resource name is automatically captured for auditing. ```APIDOC ## addNote ### Description Appends an administrative note to a player's file history. The invoking resource name is automatically captured in the background for auditing. ### Parameters - **target** (Target) - Required - One of the following target types: number (server ID), { serverId: number }, { playerId: number }, or { identifiers: { license: string } }. - **content** (string) - Required - The content of the note. - **by** (number) - Required - The database admin ID of the staff member creating the note. ### Response - **ok** (boolean) - Indicates if the operation was successful. - **data** (object) - Contains the result if successful (saved: true). - **error** (string) - Error message if the operation failed. ### Usage Example (Lua) ```lua local notePayload = { target = 42, content = "Player was warned for aggressive driving patterns.", by = 1 } local result = exports.fxmanager:addNote(notePayload) ``` ### Usage Example (JS) ```js const notePayload = { target: 42, content: "Player was warned for aggressive driving patterns.", by: 1 } const result = await exports.fxmanager.addNote(notePayload) ``` ``` -------------------------------- ### Retrieve individual player record Source: https://fxmanager.dev/docs/fxserver/player Looks up a player using a target descriptor such as server ID or license hash. ```lua -- 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 ``` ```js if (result.ok) { console.log(`Found Player: ${result.data.name}`); } else { console.error(`Lookup failed: ${result.error}`); } ``` -------------------------------- ### fetchPlayers Source: https://fxmanager.dev/docs/fxserver/player Retrieves an array of all active players currently initialized on the game server. ```APIDOC ## fetchPlayers ### Description Retrieves an array of all active players currently initialized on the game server. ### Signature `exports.fxmanager:fetchPlayers()` ### Response - **ok** (boolean) - Success status - **data** (array) - List of player objects containing id, name, playtime, identifiers, isStaff, firstSeen, lastSeen, serverId, ping, and health. - **error** (string) - Error message if ok is false. ``` -------------------------------- ### Kick a player using moderation exports Source: https://fxmanager.dev/docs/fxserver/moderation Use the kick export to remove a player from the server by providing a target, reason, and admin ID. ```lua local payload = { target = { serverId = 1 }, reason = "Exploiting game mechanics", by = 1 } local response = exports.fxManager:kick(payload) if response.ok then print("Player successfully kicked") else print("Unable to kick player:", response.error) end ``` ```ts const payload = { target: { serverId: 1 }, reason: "Exploiting game mechanics", by: 1, }; const response = await exports.fxManager.kick(payload); if (response.ok) { console.log("Player successfully kicked"); } else { console.log("Unable to kick player:", response.error); } ``` -------------------------------- ### Retrieve Recent Bans Source: https://fxmanager.dev/docs/fxserver/moderation Fetches a paginated list of recent bans using the fxmanager export. ```lua local options = { page = 1; pageSize = 5; } local result = exports.fxmanager:recentBans(options) if result.ok then for _, ban in ipairs(result.data) do print("Bane (".. ban.id ..") Player: " .. ban.name .. " - " .. ban.reason) end else print("Failed to fetch bans: " .. result.error) end ``` ```js const options = { page: 1, pageSize: 5, }; const result = await exports.fxmanager:recentBans(options); if (result.ok) { result.data.forEach(({ id, name, reason }) => console.log(`Ban: (${id}) Player: ${name} - ${reason}`) ); } else { console.error(`Failed to fetch bans: ${result.error}`); } ``` -------------------------------- ### Fetch active players Source: https://fxmanager.dev/docs/fxserver/player Retrieves all active players and iterates through the result set. ```lua 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 ``` ```js if (result.ok) { result.data.forEach(player => console.log(`Active Player: ${player.name}`) ); } else { console.error(`Failed to fetch players: ${result.error}`); } ``` -------------------------------- ### ban(target, reason, expiresAt, durationSeconds, by) Source: https://fxmanager.dev/docs/fxserver/moderation Issues a ban to a specified target player with a reason, optional expiration, and the issuing admin's ID. ```APIDOC ## ban(target, reason, expiresAt, durationSeconds, by) ### Description Issues a ban to a player. The target can be identified by server ID, database ID, or license hash. ### Parameters - **target** (Target) - Required - The player to ban (number, {serverId: number}, {playerId: number}, or {identifiers: {license: string}}). - **reason** (string) - Required - The reason for the ban. - **expiresAt** (string | null) - Optional - ISO timestamp for when the ban lifts. - **durationSeconds** (number | null) - Optional - Ban length in seconds. - **by** (number) - Required - Database ID of the admin issuing the ban. ### Response - **ok** (boolean) - Success status. - **data** (object) - Contains `banId` on success. - **error** (string) - Error message on failure. ``` -------------------------------- ### Warn a player using the warnPlayer export Source: https://fxmanager.dev/docs/fxserver/moderation Issues a warning to a player by providing a target, reason, and the issuing admin's ID. The response object indicates success or failure. ```lua local payload = { target = { serverId = 1 }, reason = "Exploiting game mechanics", by = 1 } local response = exports.fxManager:warnPlayer(payload) if response.ok then print("Player successfully warned") else print("Unable to warn player:", response.error) end ``` ```ts const payload = { target: { serverId: 1 }, reason: "Exploiting game mechanics", by: 1, }; const response = await exports.fxManager.warnPlayer(payload); if (response.ok) { console.log("Player successfully warned"); } else { console.log("Unable to warn player:", response.error); } ``` -------------------------------- ### exports.fxmanager:hasPermission(source, permission) Source: https://fxmanager.dev/docs/fxserver/permissions Checks if a player has a specific permission using the fxManager resource export. ```APIDOC ## exports.fxmanager:hasPermission(source, permission) ### Description Checks if a player has a specific permission defined in fxManager. ### Parameters - **source** (string | number) - Required - The player identifier or server ID. - **permission** (string) - Required - The permission string to check. ### Returns - **boolean** - Returns true if the player has the permission, false otherwise. ``` -------------------------------- ### searchBans Source: https://fxmanager.dev/docs/fxserver/moderation Searches for ban records based on a provided query string, such as a player name, Rockstar license, Discord ID, or ban reason. Supports optional pagination via an options object. ```APIDOC ## searchBans ### Description Searches for ban records based on a provided query string. Returns a list of matching bans or an error message. ### Parameters - **query** (string) - Required - The search term (e.g., player name, Rockstar license, Discord ID, or ban reason). - **options** (object) - Optional - Configuration object for pagination: - **page** (number) - The page number to retrieve. - **pageSize** (number) - The number of results to return per page. ### Response - **ok** (boolean) - Indicates if the request was successful. - **data** (array) - List of ban objects (if ok is true): - **id** (number) - **playerId** (number) - **name** (string) - **reason** (string) - **issuer** (number | null) - **createdAt** (Date) - **expiresAt** (Date | null) - **revokedAt** (Date | null) - **error** (string) - Error message (if ok is false) ``` -------------------------------- ### searchPlayers(query, options) Source: https://fxmanager.dev/docs/fxserver/player Searches the historical player database using a search term and optional pagination/sorting configuration. ```APIDOC ## searchPlayers(query, options) ### Description Searches the entire historical player database using text match strings alongside pagination and sorting options. ### Parameters - **query** (string) - Required - The search term (e.g., player name, Rockstar license, Discord ID, or ban reason). - **options** (Pagination) - Optional - Configuration object for sorting and pagination: - **page** (number) - The page number to retrieve. - **pageSize** (number) - The number of results to return per page. - **sortBy** ('playtime' | 'lastSeen' | 'firstSeen') - The field key used to sort the results. - **sortOrder** ('asc' | 'desc') - The direction to sort the matches. ### Response - **ok** (boolean) - Indicates if the request was successful. - **data** (object) - Contains the search results: - **page** (number) - Current page number. - **pageSize** (number) - Results per page. - **total** (number) - Total number of matches. - **items** (array) - List of player objects containing id, name, playtime, isStaff, firstSeen, and lastSeen. - **error** (string) - Error message if ok is false. ``` -------------------------------- ### warnPlayer Source: https://fxmanager.dev/docs/fxserver/moderation Issues a warning to a player. The target can be identified by server ID, database ID, or Rockstar license hash. ```APIDOC ## warnPlayer ### Description Issues a warning to a specific player with a provided reason and the issuing admin's database ID. ### Signature `exports.fxManager:warnPlayer(payload)` ### Parameters - **target** (Target) - Required - The player to warn. Can be a number (server ID), or an object containing `serverId`, `playerId`, or `identifiers`. - **reason** (string) - Required - The reason or enforcement context attached to the warning. - **by** (number) - Required - The database ID of the Admin/Staff member issuing the warning. ### Request Example { "target": { "serverId": 1 }, "reason": "Exploiting game mechanics", "by": 1 } ### Response - **ok** (boolean) - Indicates if the operation was successful. - **error** (string) - Error message if the operation failed. ``` -------------------------------- ### Define getPlayer response type Source: https://fxmanager.dev/docs/fxserver/player Defines the TypeScript structure for the result returned by the getPlayer method. ```ts type Result = { ok: true; data: { id: number; name: string; playtime: number; identifiers: Record; isStaff: boolean; firstSeen: Date; lastSeen: Date; serverId: number; ping?: number; health: number; }; } | { ok: false; error: string; } ``` -------------------------------- ### exports.fxManager:whitelistRemove Source: https://fxmanager.dev/docs/fxserver/whitelist Removes a player identifier from the whitelist system. ```APIDOC ## whitelistRemove ### Description Revokes an existing entry from the whitelist for a specific identifier. ### Parameters - **type** (string) - Required - The identifier scope classification (e.g., 'license', 'discord', 'steam'). - **value** (string) - Required - The exact identifier string being revoked from the entry logs. - **by** (number) - Optional - The database ID of the Admin/Staff member processing the whitelist revocation. ### Request Example { "type": "discord", "value": "226389308305702912", "by": 1 } ``` -------------------------------- ### Remove player from whitelist Source: https://fxmanager.dev/docs/fxserver/whitelist Revokes a player's whitelist status based on their identifier scope and value. ```lua local payload = { type = "discord", value = "226389308305702912", by = 1 } local response = exports.fxManager:whitelistRemove(payload) if response.ok then print("Player successfully removed from the whitelist.") else print("Failed to remove player from whitelist:", response.error) end ``` ```ts const payload = { type: "discord", value: "226389308305702912", by: 1, }; const response = await exports.fxManager.whitelistRemove(payload); if (response.ok) { console.log("Player successfully removed from the whitelist."); } else { console.error(`Failed to remove player from whitelist: ${response.error}`); } ``` -------------------------------- ### Define addNote Result Type Source: https://fxmanager.dev/docs/fxserver/player The expected return structure for the addNote operation, indicating success or failure. ```ts type Result = { ok: true; data: { saved: true; }; } | { ok: false; error: string; } ``` -------------------------------- ### Define Player Search Result Type Source: https://fxmanager.dev/docs/fxserver/player Defines the TypeScript structure for the searchPlayers response, including pagination metadata and player details. ```ts type Result = { ok: true; data: { page: number; pageSize: number; total: number; items: { id: number; name: string; playtime: number; isStaff: boolean; firstSeen: Date; lastSeen: Date; }[]; } | { ok: false; error: string; } ``` -------------------------------- ### Define fetchPlayers response type Source: https://fxmanager.dev/docs/fxserver/player Defines the TypeScript structure for the result returned by the fetchPlayers method. ```ts type Result = { ok: true; data: { id: number; name: string; playtime: number; identifiers: Record; isStaff: boolean; firstSeen: Date; lastSeen: Date; serverId: number; ping?: number; health: number; }[]; } | { ok: false; error: string; } ``` -------------------------------- ### Define getSelf Response Type Source: https://fxmanager.dev/docs/fxserver/player Defines the structure of the object returned by the getSelf function, including success and error states. ```ts type Result = { ok: true; data: { isAdmin: boolean; isMaster: boolean; adminId: number | null; username: string | null; group: { id: number; name: string; colour: string; icon: string | null } | null; permissions: string[]; } } | { ok: false; error: string; } ``` -------------------------------- ### revokeBan(banId, options) Source: https://fxmanager.dev/docs/fxserver/moderation Revokes an existing ban using its unique database ID. ```APIDOC ## revokeBan(banId, options) ### Description Revokes a previously issued ban by its ID. ### Parameters - **banId** (number) - Required - The unique database ID of the ban. - **options** (object) - Optional - Configuration object containing `by` (admin database ID). ### Response - **ok** (boolean) - Success status. - **data** (object) - Contains `banId` on success. - **error** (string) - Error message on failure. ``` -------------------------------- ### Define Result Wrapper Object Source: https://fxmanager.dev/docs/fxserver Defines the structure for API response handling to check success states before processing data. ```ts type Result = | { ok: true; data: T } | { ok: false; error: string }; ``` ```lua ---@class Result ---@field ok boolean ---@field data table | nil ---@field error string | nil ``` -------------------------------- ### exports.fxmanager:hasGroup(source, groupName) Source: https://fxmanager.dev/docs/fxserver/groups Checks if a player has a specific group assigned using the fxManager resource export. ```APIDOC ## exports.fxmanager:hasGroup(source, groupName) ### Description Checks if a player belongs to a specific group. The group name is a slugified version of the group's display label. ### Parameters - **source** (string | number) - Required - The player ID or identifier. - **groupName** (string) - Required - The slugified name of the group (e.g., 'super_admin'). ### Usage Example ```lua -- Lua local hasGroup = exports.fxmanager:hasGroup(source, "moderator") ``` ```js // JS const hasGroup = exports.fxmanager.hasGroup(source, "moderator"); ``` ```cs // C# bool hasGroup = Exports["fxmanager"].hasGroup(source, "moderator"); ``` ``` -------------------------------- ### Define Ban Result Type Source: https://fxmanager.dev/docs/fxserver/moderation Defines the structure of the response object returned by the ban function. ```ts type Result = { ok: true; data: { banId: number; }; } | { ok: false; error: string; } ``` -------------------------------- ### Define Recent Bans Result Type Source: https://fxmanager.dev/docs/fxserver/moderation Defines the structure of the response object returned by the recentBans export. ```ts type Result = { ok: true; data: { id: number; playerId: number; name: string; reason: string; issuer: number | null; createdAt: Date; expiresAt: Date | null; revokedAt: Date | null; }[]; } | { ok: false; error: string; } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.