> 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-money-wash/developer/server.md).

# Server

Server-sided exports

## AddBusiness

Gives a player a business. It skips the reputation and price requirements, but the player still can't own two businesses and the location must be free.

```lua
local success, reason = exports["t1ger_moneywash"]:AddBusiness(identifier, businessType, locationId)
```

**Parameters**

* `identifier` – `string` – The identifier of the player who receives the business (the framework identifier, for example the ESX identifier or the QBCore citizen ID).
* `businessType` – `string` – The business type, matching a key in `shared/locations.lua` (for example `"coffee_shop"`).
* `locationId` – `integer` – The ID of the location in `shared/locations.lua`.

**Returns**

* `boolean` – `true` if the business was given, `false` otherwise.
* `string` – `"success"`, or the reason it failed: `"business_store_not_ready"` (the script is still loading), `"invalid_player"`, `"invalid_type"`, `"invalid_location"`, `"already_owned"` (the location has an owner), `"already_owns_business"` (the player already has one) or `"database_error"`.

***

## RemoveBusiness

Removes a business permanently and puts its location back on the market. An active stock order for it is cancelled and refunded, and the owner is notified if they are online.

```lua
local success, reason = exports["t1ger_moneywash"]:RemoveBusiness(businessType, locationId)
```

**Parameters**

* `businessType` – `string` – The business type, for example `"coffee_shop"`.
* `locationId` – `integer` – The ID of the business's location.

**Returns**

* `boolean` – `true` if the business was removed, `false` otherwise.
* `string` – `"success"`, or the reason it failed: `"invalid_type"`, `"invalid_location"`, `"not_owned"` (nobody owns that location), `"raid_in_progress"`, `"review_in_progress"` (the business is busy right now) or `"database_error"`.

***

## IsBusinessInReview

Returns whether a business currently has a books review running, from the first opened desk until the folder is delivered.

```lua
local inReview = exports["t1ger_moneywash"]:IsBusinessInReview(businessId)
```

**Parameters**

* `businessId` – `integer` – The business ID.

**Returns**

* `boolean` – `true` if the business is in a review, `false` otherwise.

***

## IsOnContractShift

Returns whether a player is currently on a launder contract shift.

```lua
local onShift = exports["t1ger_moneywash"]:IsOnContractShift(source)
```

**Parameters**

* `source` – `integer` – The player's server ID.

**Returns**

* `boolean` – `true` if the player is on a shift, `false` otherwise.

***

## GetPlayerReputation

Returns a player's reputation points and the title of their current level.

```lua
local reputation = exports["t1ger_moneywash"]:GetPlayerReputation(source)
```

**Parameters**

* `source` – `integer` – The player's server ID.

**Returns**

* `table?` – The player's reputation, or `nil` if it hasn't loaded yet:
  * `points` – `integer` – The player's total reputation points.
  * `level` – `string` – The title of the player's current level (for example `"Registered"`).

***

## IsReputationReady

Returns whether a player's reputation has finished loading from the database. Check it before you read or change reputation right after a player joins.

```lua
local ready = exports["t1ger_moneywash"]:IsReputationReady(source)
```

**Parameters**

* `source` – `integer` – The player's server ID.

**Returns**

* `boolean` – `true` if the reputation is loaded, `false` otherwise.

***

## AddReputationPoints

Adds reputation points to a player and updates their screen straight away.

```lua
local success = exports["t1ger_moneywash"]:AddReputationPoints(source, amount)
```

**Parameters**

* `source` – `integer` – The player's server ID.
* `amount` – `number` – The points to add.

**Returns**

* `boolean` – `true` if the points were added, `false` if the player's reputation isn't loaded or `amount` isn't a number.

***

## RemoveReputationPoints

Removes reputation points from a player. The total never goes below `0`.

```lua
local success = exports["t1ger_moneywash"]:RemoveReputationPoints(source, amount)
```

**Parameters**

* `source` – `integer` – The player's server ID.
* `amount` – `number` – The points to remove.

**Returns**

* `boolean` – `true` if the points were removed, `false` if the player's reputation isn't loaded or `amount` isn't a number.

***

## SetReputationPoints

Sets a player's reputation points directly. The value is rounded down and never goes below `0`.

```lua
local success = exports["t1ger_moneywash"]:SetReputationPoints(source, amount)
```

**Parameters**

* `source` – `integer` – The player's server ID.
* `amount` – `number` – The new total of points.

**Returns**

* `boolean` – `true` if the points were set, `false` if the player's reputation isn't loaded or `amount` isn't a number.
