πServer Exports
What are Exports?
Exports are functions that can be called from other resources in your FiveM server. They allow different scripts to communicate and share functionality without modifying each other's code.
Think of exports as a public API - other resources can use these functions to interact with the Boss Menu system.
Money & Society Functions
GetSocietyBalance
GetSocietyBalanceGet the current balance of a company/job.
Parameters:
jobName(string) - Name of the job/company
Returns: number - Current balance
Example:
local balance = exports['m-BossMenu']:GetSocietyBalance('ambulance')
print("Hospital balance: $" .. balance)AddSocietyMoney
AddSocietyMoneyAdd money to a company account.
Parameters:
jobName(string) - Name of the job/companyamount(number) - Amount to add
Returns: boolean - Success status
Example:
RemoveSocietyMoney
RemoveSocietyMoneyRemove money from a company account.
Parameters:
jobName(string) - Name of the job/companyamount(number) - Amount to remove
Returns: boolean - Success status
Example:
Invoice Functions
CreateInvoice
CreateInvoiceCreate a new invoice from a company to a player.
Parameters:
senderId(number) - Source ID of the sendertargetId(number) - Source ID or identifier of the targetamount(number) - Invoice amountreason(string) - Reason/description for the invoicejobName(string, optional) - Job name (defaults to sender's job)
Returns: table - { success = boolean, message = string }
Example:
GetInvoices
GetInvoicesGet all invoices for a specific job.
Parameters:
jobName(string) - Name of the job/companystatus(string, optional) - Filter by status: "pending", "paid", "cancelled"
Returns: table - Array of invoice objects
Example:
CancelInvoice
CancelInvoiceCancel an existing invoice.
Parameters:
invoiceId(number) - ID of the invoice to cancel
Returns: boolean - Success status
Example:
Employee Management
GetEmployees
GetEmployeesGet all employees of a specific job.
Parameters:
jobName(string) - Name of the job/company
Returns: table - Array of employee objects
Example:
HireEmployee
HireEmployeeHire a player to a job.
Parameters:
citizenid(string) - Citizen ID of the playerjobName(string) - Job to hire them forgrade(number, optional) - Starting grade (default: 0)
Returns: boolean - Success status
Example:
FireEmployee
FireEmployeeFire an employee (set them to unemployed).
Parameters:
citizenid(string) - Citizen ID of the employee
Returns: boolean - Success status
Example:
SetEmployeeGrade
SetEmployeeGradePromote or demote an employee.
Parameters:
citizenid(string) - Citizen ID of the employeegrade(number) - New grade/rank
Returns: boolean - Success status
Example:
Warehouse Functions
GetWarehouseStock
GetWarehouseStockGet all items in a company's warehouse.
Parameters:
jobName(string) - Name of the job/company
Returns: table - Array of stock items
Example:
AddWarehouseItem
AddWarehouseItemAdd items to the warehouse.
Parameters:
jobName(string) - Name of the job/companyitemName(string) - Item identifierquantity(number) - Amount to add
Returns: boolean - Success status
Example:
RemoveWarehouseItem
RemoveWarehouseItemRemove items from the warehouse.
Parameters:
jobName(string) - Name of the job/companyitemName(string) - Item identifierquantity(number) - Amount to remove
Returns: boolean - Success status
Example:
Transaction Functions
GetTransactions
GetTransactionsGet transaction history for a company.
Parameters:
jobName(string) - Name of the job/companylimit(number, optional) - Maximum number of transactions to return
Returns: table - Array of transaction objects
Example:
AddTransaction
AddTransactionManually add a transaction record.
Parameters:
jobName(string) - Name of the job/companytype(string) - Transaction type: "deposit", "withdraw", "payment", etc.amount(number) - Transaction amountdescription(string) - Transaction descriptionclientName(string, optional) - Client name (default: "System")
Returns: boolean - Success status
Example:
Duty Clock Functions
GetDutyStatus
GetDutyStatusCheck if a player is currently on duty.
Parameters:
citizenid(string) - Citizen ID of the player
Returns: table - { onDuty = boolean, data = table or nil }
Example:
ClockIn
ClockInClock in a player to start their duty.
Parameters:
citizenid(string) - Citizen ID of the playerjobName(string) - Job name
Returns: boolean - Success status
Example:
ClockOut
ClockOutClock out a player to end their duty.
Parameters:
citizenid(string) - Citizen ID of the player
Returns: boolean - Success status
Example:
GetDutyHours
GetDutyHoursGet total duty hours for a player.
Parameters:
citizenid(string) - Citizen ID of the playerperiod(string, optional) - Time period: "today", "week", "month", or nil (all time)
Returns: number - Total hours worked
Example:
Practical Use Cases
Example 1: Custom Job Payment System
Example 2: Auto-Fine System
Example 3: Warehouse Integration
Example 4: Company Balance Check
Important Notes
Server-Side Only: All exports are server-side only for security
Error Handling: Always check return values before proceeding
Citizen ID Format: Use the correct identifier format for your framework (QBCore vs ESX)
Database: Ensure all database tables are properly installed
Last updated