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

# Installation

> Step-by-step guide to install and set up the FFA script on your FiveM server.

import {
  Steps,
  Step,
  CardGroup,
  Card,
  Tip,
  Info,
  Warning,
} from "nextra-theme-docs";
import { Tabs } from "nextra/components";

## Installation Guide

<Tabs>
  <Tab title="Step-by-Step Guide">
    ### Complete Installation

    <Steps>
      <Step title="Download the Resource">
        1. Purchase the script from [Resrant Scripts](https://resrant-scripts.tebex.io/package/5293649)
        2. Download the ZIP file from your [Cfx.re Keymaster](https://keymaster.fivem.net/assets) ("Purchased Assets" tab)

        <Tip>
          Regularly check Keymaster for updates to your purchased resources.
        </Tip>
      </Step>

      <Step title="Prepare Your Database">
        Import the `insert.sql` file (included with the script) into your server's database.

        ```sql insert.sql theme={null}
        CREATE TABLE `ffa_users` (
          `id` int(11) NOT NULL,
          `url` varchar(255) DEFAULT 'http://i.imgur.com/gsnPQRw.png',
          `identifier` varchar(255) NOT NULL,
          `name` longtext NOT NULL,
          `steamname` longtext DEFAULT NULL,
          `kills` int(11) NOT NULL DEFAULT 0,
          `deaths` int(11) NOT NULL DEFAULT 0,
          `playtime` varchar(255) DEFAULT '0',
          `loadout` longtext DEFAULT NULL,
          `options` varchar(255) DEFAULT '"[]"'
          ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

        ALTER TABLE `ffa_users`
          ADD PRIMARY KEY (`id`);

        ALTER TABLE `ffa_users`
          MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
        COMMIT;

        CREATE TABLE `ffa_chart` (
          `id` int(11) NOT NULL,
          `chart` longtext DEFAULT NULL,
          `categories` longtext DEFAULT NULL
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

        ALTER TABLE `ffa_chart`
          ADD PRIMARY KEY (`id`);

        ALTER TABLE `ffa_chart`
          MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
        COMMIT;
        ```

        <Info>
          Ensure your database user has permissions to create tables and modify them.
        </Info>
      </Step>

      <Step title="Add the Resource to Your Server">
        1. Unzip the downloaded file. This will create a folder (e.g., `rs_ffa`).
        2. Transfer this folder into your server's `resources` directory.

        <Tip>
          For best results, upload the ZIP file directly to your server and extract it there to avoid file corruption.
        </Tip>
      </Step>

      <Step title="Enable the Resource in Server Configuration">
        Open your `server.cfg` file and add the following line, replacing `[resource_name]` with the actual folder name of the script:

        ```cfg server.cfg theme={null}
        ensure [resource_name]
        ```

        For example: `ensure rs_ffa`

        <Info>
          The `ensure` command is preferred over `start` as it manages resource dependencies more effectively.
        </Info>
      </Step>

      <Step title="Configure the Script (Basic)">
        Navigate to the resource's folder and open `config.lua` with a text editor. Review basic settings. Detailed configuration is covered separately.

        <Tip>
          Always refer to the specific documentation page for your resource for detailed configuration guidance.
        </Tip>
      </Step>

      <Step title="Start/Restart Your Server">
        Launch your FiveM server or restart it if it's already running.

        <Warning>
          A full server restart is recommended when adding new resources to ensure all changes are applied correctly.
        </Warning>

        Verify that the resource is running correctly by checking the server console for any error messages related to the script.
      </Step>
    </Steps>
  </Tab>

  <Tab title="Quick Installation">
    ### Quick Install

    1. Purchase and download the script.
    2. Import `insert.sql` to your database.
    3. Extract the script folder to your server's `resources` directory.
    4. Add `ensure [resource_name]` (e.g., `ensure rs_ffa`) to your `server.cfg`.
    5. Restart your server.
  </Tab>
</Tabs>
