# FiveM (Server Wrapper)

The **Tebex Server Wrapper** for FiveM simplifies the process of delivering in-game rewards and perks to players, enhancing your Tebex Store experience. Once installed and configured, players can redeem their purchases using a unique Transaction ID directly in-game.

***

### Overview

* **Players use:** `/redeem [Transaction ID]`
* **Transaction IDs look like:** `tbx-xxxxxxxx-xxxx`
* **Found in:** Payment confirmation page and email
* **Purpose:** To automatically deliver packages purchased via Tebex without relying on a direct Tebex plugin or RCON.

***

### Prerequisites

Before installing the wrapper:

1. You must have a **Tebex Store** connected to your **FiveM server**.\
   ➤ Follow the official setup guide to connect your server.
2. Ensure your server supports **MySQL**, as the wrapper requires it for tracking transactions.

***

### Installation Instructions

#### 1. Download and Install the Wrapper

* Download the [wrapper from this link](https://github.com/najeetpie/nass_serverstore).
* Place the unzipped folder into your server’s `resources` directory.
  * Rename the folder to:

    ```bash
    nass_serverstore
    ```
  * Remove any `-main` suffix from the folder name if present.

***

#### 2. Import Database Structure

* Locate the `codes.sql` file inside the wrapper package.
* Import it into your server's **MySQL database** using your preferred tool (e.g., phpMyAdmin, HeidiSQL).

<figure><img src="https://1152203580-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LuI8PwvsHA79mTA-7bh%2Fuploads%2FKhsCe4BPtKGs6STA3iA0%2FScreenshot%202025-02-20%20at%2011.44.42.png?alt=media&#x26;token=b664dbb4-e7f5-4e42-82d1-9d72b3f48534" alt=""><figcaption></figcaption></figure>

***

#### 3. Configure Your Server

* In your `server.cfg`, add:

  ```cfg
  ensure nass_serverstore
  ```

<figure><img src="https://1152203580-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LuI8PwvsHA79mTA-7bh%2Fuploads%2FnX2oh4UtuuBSeSg94DT5%2FDBImports.png?alt=media&#x26;token=fb03a812-7630-4ba1-ae04-15dec75577d7" alt=""><figcaption></figcaption></figure>

***

#### 4. Configure Tebex Packages

For each package you want to support with the wrapper:

* In your Tebex Control Panel, go to **Packages > Edit Package > Commands**.
* Add the following command:

  ```json
  purchase_package_tebex {"transid":"{transaction}", "packagename":"{packageName}"}
  ```

  > ⚠️ **Important:** Do not modify the variable placeholders. Use them exactly as shown.
* Click the ⚙️ gear icon next to the command and set:
  * **Require Player to be Online:** `Execute the command even if the player is offline`
* Press **Update** to save changes.

<figure><img src="https://1152203580-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LuI8PwvsHA79mTA-7bh%2Fuploads%2FNdIZ4r37HUtyCa69tQXh%2Fcommandsetup.png?alt=media&#x26;token=c1c82662-d65c-4eef-8a14-e5ea6af5c3aa" alt=""><figcaption></figcaption></figure>

***

#### 5. Configure the Wrapper Script

* Open the `config.lua` file located inside the `nass_serverstore` script folder.
* Define your package details and settings there.

<figure><img src="https://1152203580-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LuI8PwvsHA79mTA-7bh%2Fuploads%2F372aPa5LCDhuKZBpjTjT%2Fconfiglua.png?alt=media&#x26;token=d17eb24d-0d99-4901-9573-59aa1d6a7a3a" alt=""><figcaption></figcaption></figure>

***

### Testing the Setup

Once everything is in place:

1. Make a test purchase on your Tebex store.
2. In the FiveM server, enter the following command as a player:

   <pre class="language-bash"><code class="lang-bash"><strong>/redeem tbx-12345678-91011
   </strong></code></pre>

If set up correctly, the purchased items or commands will be delivered to the player.

***

### Notes

* This setup bypasses the need for direct command polling by using the redeem flow.
* Ideal for creators who want a lightweight integration or custom control over redemptions.
* For more advanced automation, consider combining this with Tebex Plugin or RCON options.

***

### FAQs

**Q: Can I use both this wrapper and the native FiveM Tebex integration?**\
A: It’s recommended to use one method consistently to avoid conflicts.

**Q: What if the command doesn’t work?**\
A: Verify:

* The `tebexSecret` is set properly.
* The database was imported successfully.
* You’re using a valid `tbx-` transaction ID.

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tebex.io/creators/tebex-control-panel/game-servers/fivem/fivem-server-wrapper.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
