# Exports

{% hint style="danger" %}

### **Important!**

All this exports are only for server side.
{% endhint %}

***

These functions are exports by the VIP system for other server scripts to use directly, making integration easier.

***

#### AddDiamonds(playerId, amount)

Adds a specified amount of diamonds to the player.

* Updates the player's VIP data.
* Sends an update to the client with the new data.

**Usage:**

```lua
exports['mg-vipsystem']:AddDiamonds(playerId, amount)
```

***

#### RemoveDiamonds(playerId, amount)

Removes a specified amount of diamonds from the player, never letting the value go below zero.

* Updates and sends the updated data to the client.

**Usage:**

```lua
exports['mg-vipsystem']:RemoveDiamonds(playerId, amount)
```

***

#### SetVIP(playerId, tier)

Sets the player's VIP level to the specified tier (between 1 and the maximum defined in the config).

* Updates the database and notifies the client.

**Usage:**

```lua
exports['mg-vipsystem']:SetVIP(playerId, tier)
```

***

#### RemoveVIP(playerId)

Removes the player's VIP status by setting the tier to `nil`.\
This is a shortcut for `SetVIP(playerId, nil)`.

**Usage:**

```lua
exports['mg-vipsystem']:RemoveVIP(playerId)
```

***

#### CheckVIP(playerId)

Checks the player's VIP status and returns data if it exists:

* tier (VIP level)
* expiresAt (expiration timestamp)
* active (boolean indicating if VIP is still active)

**Usage:**

```lua
local vipInfo = exports['mg-vipsystem']:CheckVIP(playerId)
if vipInfo and vipInfo.active then
    -- VIP is active
end
```
