> ## Documentation Index
> Fetch the complete documentation index at: https://docs.r-scripts.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> Step-by-step guide to install R_Store on your FiveM server

## Prerequisites

Before installing R\_Store, ensure you have:

<Steps>
  <Step title="Required Dependencies">
    * **ox\_lib** - UI and utilities
    * **oxmysql** - Database operations
    * **Framework** - ESX, QBCore, or QBX
  </Step>
</Steps>

## Installation Steps

<Steps>
  <Step title="Download & Extract">
    1. Download R\_Store from your [cfx.re](http://cfx.re) portal
    2. Extract the folder to your server's `resources` directory
    3. Ensure the folder is named `r_store`
  </Step>

  <Step title="Database Setup">
    Choose one of the following methods:

    ### Method 1: Manual Import

    Import the `.sql` file from the r\_store folder into your database.

    ```sql theme={null}
    CREATE TABLE `r_store_players` (
        `id` INT(11) NOT NULL AUTO_INCREMENT,
        `player_identifier` VARCHAR(46) NOT NULL COLLATE 'latin1_swedish_ci',
        `coins` INT(11) NOT NULL DEFAULT 0,
        PRIMARY KEY (`id`) USING BTREE,
        UNIQUE INDEX `player_identifier` (`player_identifier`) USING BTREE
    );

    CREATE TABLE `r_store_purchases` (
        `id` INT(11) NOT NULL AUTO_INCREMENT,
        `player_identifier` VARCHAR(46) NOT NULL COLLATE 'latin1_swedish_ci',
        `item_name` VARCHAR(255) NOT NULL COLLATE 'latin1_swedish_ci',
        `item_type` ENUM('vehicle','item','weapon','money') NOT NULL COLLATE 'latin1_swedish_ci',
        `quantity` INT(11) NOT NULL DEFAULT 1,
        `cost_coins` INT(11) NOT NULL,
        `purchase_date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
        PRIMARY KEY (`id`) USING BTREE,
        INDEX `player_identifier` (`player_identifier`) USING BTREE
    );
    ```

    ### Method 2: Auto-Insert (Recommended)

    1. Open `config.lua`
    2. Set `R.EnableAutoinsert = true`
    3. Start the resource
    4. Set `R.EnableAutoinsert = false` after tables are created **(if you wish)**
  </Step>

  <Step title="Configure Framework">
    Open `config.lua` and configure your framework:

    <Tabs>
      <Tab title="ESX">
        ```lua theme={null}
        R.Framework = "ESX"
        R.newESX = true -- Set to false for ESX 1.1
        R.CoreName = "es_extended"
        R.Inventory = "ox_inventory"
        ```
      </Tab>

      <Tab title="QBCore">
        ```lua theme={null}
        R.Framework = "qbcore"
        R.Inventory = "qb-inventory"
        ```
      </Tab>

      <Tab title="QBX">
        ```lua theme={null}
        R.Framework = "qbx"
        R.Inventory = "ox_inventory"
        ```
      </Tab>
    </Tabs>
  </Step>

  <Step title="Configure Target (Optional)">
    If you use a target system:

    ```lua theme={null}
    R.UseTarget = true
    R.Target = "ox_target" -- or "qb-target"
    ```

    If you don't use target:

    ```lua theme={null}
    R.UseTarget = false
    ```
  </Step>

  <Step title="Add to server.cfg">
    Add r\_store to your server.cfg **after** dependencies:

    ```cfg theme={null}
    # Dependencies
    ensure ox_lib
    ensure oxmysql
    ensure es_extended
    ensure ox_inventory

    # R-Scripts
    ensure r_store
    ```

    <Warning>
      Order matters! Ensure dependencies are loaded before r\_store.
    </Warning>
  </Step>
</Steps>

## Next Steps

<CardGroup cols={2}>
  <Card title="Configuration Guide" icon="gear" href="/r_store/configuration">
    Customize your store settings
  </Card>

  <Card title="Learn About Exports" icon="code" href="/r_store/exports">
    Integrate with other resources
  </Card>
</CardGroup>

## Troubleshooting

Having issues? Check common problems:

<Card title="Common Issues" icon="wrench" href="/r_store/common-issues">
  View troubleshooting guide
</Card>
