For the complete documentation index, see llms.txt. This page is also available as Markdown.

Server

Use these exports to read or manage dealership data from another resource. Call them on the server.

🏢 Dealership Management

addDealership

Creates a new dealership.

---@param playerId number | Admin who is creating the dealership
---@param dealership table | Dealership payload (name, type, area, points, business?, framework_job?, blip?)
---@return table result | { success: boolean, error?: string, dealershipId?: string }
local result = exports.rcore_dealership:addDealership(playerId, dealership)

Admin only. Validates the payload (name, type, area polygon, and required points) and broadcasts the new dealership to all clients.

updateDealership

Updates an existing dealership.

---@param playerId number | Admin performing the update
---@param dealership table | Dealership payload including numeric `id`
---@return table result | { success: boolean, error?: string }
local result = exports.rcore_dealership:updateDealership(playerId, dealership)

Admin only. Changing framework_job clears the dealership's existing permissions.

deleteDealership

Deletes a dealership.

---@param playerId number | Admin performing the deletion
---@param dealershipId number
exports.rcore_dealership:deleteDealership(playerId, dealershipId)

Admin only. Broadcasts the deletion to all clients.

updateDealershipPoint

Updates a single named point of a dealership.

---@param playerId number | Admin performing the update
---@param dealershipId number
---@param pointName string | Zone/point key
---@param coords table | New point coordinates
exports.rcore_dealership:updateDealershipPoint(playerId, dealershipId, pointName, coords)

Admin only.

deleteDealershipPoint

Removes a named point from a dealership.

Admin only.

addDealershipModels

Adds vehicle models to a dealership's catalog.

Admin only. Models already in the catalog are skipped.

deleteDealershipModels

Removes vehicle models from a dealership's catalog.

Admin only. Note models here is a list of model names, not a map. Passing nil clears every model.

👔 Employees & Permissions

getDealershipTopEmployee

Returns the top employee of the current period for a dealership.

Returns nil if there was no activity in the period. Ranked by revenue, then stock, then orders.

hasEmployeePermission

Checks whether a player's job and grade grant a permission at a business dealership.

Returns false if the dealership is not a business or the player's job does not match its framework_job.

getEmployeePermissions

Returns the full grade-to-permission map for a business dealership.

Returns {} unless the querying player works at the dealership.

setEmployeePermission

Grants or revokes a permission for a job grade at a business dealership.

The change is audit-logged when a player performed it.

getDealershipBossJobGradeId

Returns the boss (highest) job grade id for a business dealership.

💰 Finance

isPlateFinanced

Checks whether a plate is under an active finance contract for an identifier.

getPlayerFinances

Returns a player's active vehicle finance contracts with display info.

Returns {} if the player's identifier cannot be resolved.

🔢 Purchase

validatePlate

Validates a custom plate against length, allowed characters, and uniqueness.

Length bounds come from Config.Dealership.Purchase.CustomPlate.

📋 NPC Orders

generateNpcOrder

Generates a random NPC vehicle order for a business dealership.

Returns nil if the dealership is not a business, has no models, or has no models under the value cap. The Billboard Ads upgrade raises the cap and biases orders toward pricier vehicles.

hasDealershipPendingOrders

Checks whether a dealership has any pending or in-progress orders.

hasDealershipOnlineEmployees

Checks whether any employee of the dealership's job is online.

🚗 Test Drive

canPlayerStartTestDrive

Checks whether a player may start a test drive.

Business drives require the dealership's job and the TEST_DRIVE permission. Customer drives check penalty and cooldown windows.

getPlayerTestDrivePenalties

Checks whether an identifier is currently banned from test drives.

Thresholds come from Config.Dealership.TestDrive.Penalty.

⬆️ Upgrades

hasDealershipUpgrade

Checks whether a dealership has a boolean upgrade active.

Only returns true for boolean upgrades. Leveled upgrades (stored as a number) are not reported here - use getDealershipUpgrades to read their level.

getDealershipUpgrades

Returns all upgrades for a dealership.

Returns {} for non-business or unloaded dealerships.

🧾 Audit

recordAudit

Writes an audit-log entry for a business dealership and notifies open tablets.

Silently ignored if the dealership is not a loaded business or the player's identifier cannot be resolved.

Last updated