> For the complete documentation index, see [llms.txt](https://docs.t1ger.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.t1ger.net/resources/t1ger-tuning/exports/server.md).

# Server

Server-sided exports

## TrimPlate

Trims leading and trailing spaces from a plate string. Ensures plate numbers are formatted correctly to prevent inconsistencies in database lookups.

```lua
exports["t1ger_tuning"]:TrimPlate(plate)
```

**Parameters**

* **plate** *(string)* – The plate string to be trimmed.

**Returns**

* **string** – The trimmed plate.

***

## GetVehicleEngineSwap

Returns cached engine swap data for a plate, loading from the database on first access. Acts as a fallback for entries not yet preloaded (e.g. created after the last resource start).

```lua
exports["t1ger_tuning"]:GetVehicleEngineSwap(plate)
```

**Parameters**

* **plate** *(string)* – The vehicle plate.

**Returns**

* **table|nil** – `{ vehicle, engine }`, or `nil` if no engine swap data exists for this plate.

***

## SetVehicleEngineSwap

Saves engine swap data for a plate — updates cache, database and vehicle statebag. Only persists to the database if the vehicle is actually owned, to avoid orphaned rows for test/NPC vehicles. Still applies visually/in-memory regardless.

```lua
exports["t1ger_tuning"]:SetVehicleEngineSwap(netId, plate, data)
```

**Parameters**

* **netId** *(number)* – Network ID of the vehicle.
* **plate** *(string)* – The vehicle plate.
* **data** *(table)* – `{ vehicle = modelName, engine = soundName }`.

***

## GetModOrders

Returns all currently tracked mod orders.

```lua
exports["t1ger_tuning"]:GetModOrders()
```

**Returns**

* **table** – All mod orders, keyed by plate.

***

## GetModOrder

Returns the mod order for a specific plate.

```lua
exports["t1ger_tuning"]:GetModOrder(plate)
```

**Parameters**

* **plate** *(string)* – The vehicle plate.

**Returns**

* **table|nil** – The mod order data, or `nil` if no active order exists for this plate.

***

## GetCombinedShops

Returns the slim shop data cache used for combined (mechanic + tuning) shops, so other resources can read it without listening for events.

```lua
exports["t1ger_tuning"]:GetCombinedShops()
```

**Returns**

* **table** – All combined shops, keyed by shop ID.

***

## SetCombinedOwner

Sets or clears the owner of a combined shop in the slim cache.

```lua
exports["t1ger_tuning"]:SetCombinedOwner(target, shopId, newOwner)
```

**Parameters**

* **target** *(integer)* – Player ID, or `-1` to broadcast to everyone.
* **shopId** *(integer)* – The shop ID.
* **newOwner** *(string|nil)* – The new owner's identifier, or `nil` to clear the owner.

***

## AddCombinedEmployee

Adds an employee to a combined shop's slim cache.

```lua
exports["t1ger_tuning"]:AddCombinedEmployee(target, shopId, employee)
```

**Parameters**

* **target** *(integer)* – Player ID, or `-1` to broadcast to everyone.
* **shopId** *(integer)* – The shop ID.
* **employee** *(table)* – Employee data `{ identifier, grade, label? }`.

***

## UpdateCombinedEmployee

Updates an employee's data in the slim cache.

```lua
exports["t1ger_tuning"]:UpdateCombinedEmployee(target, shopId, employee)
```

**Parameters**

* **target** *(integer)* – Player ID, or `-1` to broadcast to everyone.
* **shopId** *(integer)* – The shop ID.
* **employee** *(table)* – The updated employee data.

***

## RemoveCombinedEmployee

Removes an employee by identifier from the slim cache.

```lua
exports["t1ger_tuning"]:RemoveCombinedEmployee(target, shopId, identifier)
```

**Parameters**

* **target** *(integer)* – Player ID, or `-1` to broadcast to everyone.
* **shopId** *(integer)* – The shop ID.
* **identifier** *(string)* – The employee identifier to remove.

***

## IsPlayerEmployee

Checks if a player is an employee of a specific shop, or any shop.

```lua
exports["t1ger_tuning"]:IsPlayerEmployee(src, shopId)
```

**Parameters**

* **src** *(number)* – The player's server ID.
* **shopId** *(number, optional)* – The shop ID to check. If omitted, checks all shops.

**Returns**

* **boolean** – `true` if the player is an employee, otherwise `false`.
* **number|nil** – The ID of the shop the player is employed at, or `nil` if not found.

***

## IsPlayerTunerBoss

Checks if a player's job is boss-grade at a specific tuner shop, or any shop.

```lua
exports["t1ger_tuning"]:IsPlayerTunerBoss(src, shopId)
```

**Parameters**

* **src** *(number)* – The player's server ID.
* **shopId** *(number, optional)* – The shop ID to check. If omitted, checks all shops.

**Returns**

* **boolean** – `true` if the player is a boss-grade tuner, otherwise `false`.
* **number|nil** – The ID of the shop where the player is boss, or `nil` if not found.

***

## IsPlayerShopOwner

Checks if a player is the owner of a specific shop, or any shop.

```lua
exports["t1ger_tuning"]:IsPlayerShopOwner(src, shopId)
```

**Parameters**

* **src** *(number)* – The player's server ID.
* **shopId** *(number, optional)* – The shop ID to check. If omitted, checks all shops.

**Returns**

* **boolean** – `true` if the player owns the shop, otherwise `false`.
* **number|nil** – The ID of the owned shop, or `nil` if not found.

***

## AddEmployee

Adds an employee to a shop.

```lua
exports["t1ger_tuning"]:AddEmployee(shopId, jobGrade, setJob, srcOrIdentifier)
```

**Parameters**

* **shopId** *(number)* – The shop ID.
* **jobGrade** *(number)* – The job grade to assign.
* **setJob** *(boolean|nil)* – Whether to set the player's job.
* **srcOrIdentifier** *(number|string)* – Player source or identifier.

**Returns**

* **boolean** – `true` on success.

***

## RemoveEmployee

Removes an employee from a shop.

```lua
exports["t1ger_tuning"]:RemoveEmployee(shopId, setJob, srcOrIdentifier)
```

**Parameters**

* **shopId** *(number)* – The shop ID.
* **setJob** *(boolean|nil)* – Whether to reset the player's job.
* **srcOrIdentifier** *(number|string)* – Player source or identifier.

**Returns**

* **boolean** – `true` on success.

***

## UpdateEmployee

Updates an employee's job grade in a shop.

```lua
exports["t1ger_tuning"]:UpdateEmployee(shopId, jobGrade, setJob, srcOrIdentifier)
```

**Parameters**

* **shopId** *(number)* – The shop ID.
* **jobGrade** *(number)* – The new job grade.
* **setJob** *(boolean|nil)* – Whether to set the player's job.
* **srcOrIdentifier** *(number|string)* – Player source or identifier.

**Returns**

* **boolean** – `true` on success.

***

## GetVehicleNitrous

Returns cached nitrous data for a plate. Purely an in-memory lookup — the cache is fully populated at startup and kept up to date on every install, so there's nothing left to fall back to a database query for.

```lua
exports["t1ger_tuning"]:GetVehicleNitrous(plate)
```

**Parameters**

* **plate** *(string)* – The vehicle plate.

**Returns**

* **table|nil** – `{ size, shots, burst, color }`, or `nil` if no nitrous data exists for this plate.

***

## TrySaveVehicleNitrous

Saves a vehicle's current nitrous data, read live from its statebag. Stateless — most vehicles never have nitrous data at all, so this bails out on a single free table read for the vast majority of calls.

```lua
exports["t1ger_tuning"]:TrySaveVehicleNitrous(vehicle)
```

**Parameters**

* **vehicle** *(number)* – The vehicle entity handle.

***

## GetVehicleDyno

Returns cached dyno data for a plate. Purely an in-memory lookup — the cache is fully populated at startup and kept up to date on every save, so there's nothing left to fall back to a database query for.

```lua
exports["t1ger_tuning"]:GetVehicleDyno(plate)
```

**Parameters**

* **plate** *(string)* – The vehicle plate.

**Returns**

* **table|nil** – `{ torque, power, brakes }`, or `nil` if no dyno data exists for this plate.

***

## SetVehicleDyno

Saves dyno data for a plate — updates cache, database and vehicle statebag. Values are clamped to the configured slider ranges regardless of what's sent, since this feature has no payment gate to naturally limit abuse.

```lua
exports["t1ger_tuning"]:SetVehicleDyno(netId, plate, data)
```

**Parameters**

* **netId** *(number)* – Network ID of the vehicle.
* **plate** *(string)* – The vehicle plate.
* **data** *(table)* – `{ torque, power, brakes }`.

**Returns**

* **boolean** – `true` on success.
