# Server

## GetReputationData

Returns basic reputation stats as a plain table.

```lua
exports["t1ger_chopshop"]:GetPlayerReputation(src)
```

**Parameters**

* `src` *(number)* – The player's server ID.

**Returns**

* `table|nil` – A table with:
  * `points` *(integer)* – Reputation points
  * `parts` *(integer)* – Total parts chopped
  * `scraps` *(integer)* – Total full vehicles scrapped

***

## AddReputationPoints

Adds reputation points to a player and syncs it to their statebag.

```lua
exports["t1ger_chopshop"]:AddReputationPoints(src, amount)
```

**Parameters**

* `src` *(number)* – The player's server ID.
* `amount` *(number)* – The amount of XP to add.

**Returns**

* `boolean` – `true` if successful, `false` otherwise.

***

## RemoveReputationPoints

Removes reputation points from a player (min 0), and syncs to statebag.

```lua
exports["t1ger_chopshop"]:RemoveReputationPoints(src, amount)
```

**Parameters**

* `src` *(number)* – The player's server ID.
* `amount` *(number)* – The amount of XP to remove.

**Returns**

* `boolean` – `true` if successful, `false` otherwise.

***

## SetReputationPoints

Sets a player’s reputation points directly and syncs to statebag.

```lua
exports["t1ger_chopshop"]:SetReputationPoints(src, amount)
```

**Parameters**

* `src` *(number)* – The player's server ID.
* `amount` *(number)* – The amount of XP to remove.

**Returns**

* `boolean` – `true` if successful, `false` otherwise.

***

## GetChopList

Returns the current active Chop List entries.

```lua
exports["t1ger_chopshop"]:GetChopList()
```

**Returns**

* `ChopListEntry[]` – An array of chop list entries with model, hash, quota, and remaining fields.

***

## GetChopListRefreshTime

Returns the remaining time (in seconds) until the next Chop List refresh.

```lua
exports["t1ger_chopshop"]:GetChopListRefreshTime()
```

**Returns**

* `integer` – Seconds remaining until the next chop list update.

{% hint style="info" %}
💡 Divide by 60 and round down if you want minutes.
{% endhint %}

***

## RefreshChopList

Force-refreshes the Chop List immediately. Useful for admin tools, debugging, or manual triggers.

```lua
exports["t1ger_chopshop"]:RefreshChopList()
```

**Returns**

* `void`

***

## CreateBounty

Creates a bounty entry in the database and deducts the reward from the player's cash.\
Only valid, existing vehicles (if a plate is provided) and players with sufficient funds can place a bounty.

```lua
exports["t1ger_chopshop"]:CreateBounty(src, model, plate, reward)
```

**Parameters**

* `src` (`number`) – The server ID of the player placing the bounty.
* `model` (`string`) – The vehicle model name (e.g., `"sultan"`).
* `plate` (`string | nil`) – *(Optional)* Specific license plate to target. If `nil`, any vehicle of the model is valid.
* `reward` (`number`) – The cash reward the player is offering for the bounty.

**Returns**

* `boolean` – `true` if the bounty was created successfully, `false` if validation failed (e.g., invalid model, unowned plate, insufficient funds).

***

## RemoveBounty

Removes an active bounty from the database and optionally refunds the player based on configuration.\
Only valid, unclaimed bounties placed by the requesting player can be removed.

```lua
exports["t1ger_chopshop"]:RemoveBounty(src, bountyId)
```

#### Parameters

* `src` (`number`) – The server ID of the player attempting to remove the bounty.
* `bountyId` (`number`) – The database ID of the bounty to be removed.

#### Returns

* `boolean` – `true` if the bounty was removed successfully, `false` if validation failed (e.g., bounty not found, not owned by player, already completed).

{% hint style="info" %}
Refund amount depends on config:

* `Config.Bounty.RefundOnRemoval = "full"` → full reward refunded.
* `Config.Bounty.RefundOnRemoval = "partial"` → commission deducted (`Config.Bounty.Commission`%).
* `Config.Bounty.RefundOnRemoval = "none"` → no refund.

Only active bounties (`state = 0`) can be removed.
{% endhint %}

***
