> ## 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.

# Configuration

> Unlock the full potential of the Clothing script by fine-tuning its options in `config.lua`.

import {
  AccordionGroup,
  Accordion,
  Tip,
  Info,
  Callout,
} from "nextra-theme-docs";

# Mastering Your Clothing Script: `config.lua` Deep Dive

The Clothing Script offers a wealth of customization options via its `config.lua` file, typically found in `resources/rs_clothing/config.lua`. This guide will walk you through configuring every aspect to tailor the script perfectly to your server's needs.

<Callout type="warning">
  Always create a backup of your `config.lua` file before making significant
  changes to avoid losing your configuration.
</Callout>

## Core System Setup

These settings form the foundational link with your ESX framework and control the script's basic operational behaviors.

<AccordionGroup>
  <Accordion title="ESX Framework Integration">
    ### Custom ESX Event Prefixes

    If your server uses custom ESX event prefixes, adjust these settings to ensure compatibility:

    ```lua theme={null}
    -- ESX Event Configuration
    Config.CustomESXPrefixEvents = "esx:"
    Config.CustomESX_SKINPrefixEvents = "esx_skin:"
    Config.CustomESX_ADDONACCOUNTPrefixEvents = "esx_addonaccount:"
    Config.CustomESX_SKINCHANGEPrefixEvents = "skinchanger:"
    ```

    ### ESX Shared Object

    The script needs to access the ESX shared object, typically handled by:

    ```lua theme={null}
    -- ESX Shared Object
    Config.ESXSharedObject = function()
        ESX = nil
        TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
    end
    ```

    <Tip>
      If you're using a newer version of ESX that uses exports instead of events, you'll need to modify this function accordingly.
    </Tip>
  </Accordion>

  <Accordion title="General Settings">
    ### Core Functionality Options

    Configure the basic operational settings for the script:

    ```lua theme={null}
    -- General Settings
    Config.Debug = false -- Enable for verbose logging in console (useful for troubleshooting)
    Config.OpenMenuKey = "E" -- Key to open the clothing store menu
    Config.OpenTimeout = 500 -- Cooldown in milliseconds to prevent menu spam
    Config.Dimension = true -- When true, players enter a separate dimension when using the clothing store
    -- Note: Requires OneSync Infinity
    Config.SaveFullOutfit = true -- When true, saves the entire current outfit when a player saves an outfit
    ```

    <Info>
      Setting `Config.Dimension = true` creates a better user experience by isolating players while they change clothes, but requires OneSync Infinity to be enabled on your server.
    </Info>
  </Accordion>
</AccordionGroup>

## Interface & Player Feedback

Customize how the script communicates with your players, from notifications to in-menu text.

<AccordionGroup>
  <Accordion title="Notification System & Localization">
    ### Custom Notifications

    Customize how notifications are displayed to players and integrate with your existing notification system:

    ```lua theme={null}
    -- Standard ESX Notification
    Config.Notification = function(text)
        TriggerEvent('esx:showNotification', text)
    end

    -- Help Text Notification (shown at the bottom of the screen)
    Config.OpenNotification = function(text)
        SetTextComponentFormat("STRING")
        AddTextComponentString(text)
        DisplayHelpTextFromStringLabel(0, 0, 1, -1)
    end
    ```

    ### Localization

    Customize the text messages displayed to players:

    ```lua theme={null}
    -- Localization Settings
    Config.Locals = {
        clothesbought = "You've bought some new clothes!",
        outfitsaved = "Outfit has been saved!",
        outfitdeleted = "Outfit has been deleted!",
        notenoughmoney = "Not enough money!",
        editname = "Outfit name has been changed!",
    }
    ```

    <Tip>
      To integrate with custom notification systems like pNotify, mythic\_notify, or ox\_lib, replace the `Config.Notification` function with the appropriate event trigger for your system.
    </Tip>
  </Accordion>
</AccordionGroup>

## Economy & Storefronts

Manage your in-game clothing economy, define store locations, and set up item availability and pricing.

<AccordionGroup>
  <Accordion title="Clothing Store Locations">
    ### Store Configuration

    Define where clothing stores are located on the map. You can add multiple stores with different settings:

    ```lua theme={null}
    Config.Locations = {
        [1] = { -- Unique ID for the store location
            ShowMarker = true, -- Display a marker at the location
            ShowBlip = true,   -- Display a map blip for this store
            
            -- Outfit Sales Payout Configuration
            GiveOutfitOwnerMoney = "empty", -- Who receives money from shared outfit sales:
                                           -- 'society', 'owner', or 'empty' (no one)
            SocietyNameOutfit = "police",  -- Society account name if using 'society' option
            
            -- Clothing Purchase Payout Configuration
            GiveBuyClothingMoney = "empty", -- Who receives money from clothing sales:
                                           -- 'society' or 'empty'
            SocietyNameClothing = "police", -- Society account name if using 'society' option
            
            MoneyPercentage = 100, -- Percentage of sale price given to society/owner
            
            Location = vector4(72.3, -1399.1, 28.4, -90.0), -- Store coordinates (x, y, z, heading)
            
            -- Marker Configuration
            Marker = {
                DrawDistance = 25.0,
                Scale = vector3(1.5, 1.5, 1.0),
                InteractDist = 1.5, -- Distance from which menu can be opened
                Colour = {r = 245, g = 135, b = 46},
                Alpha = 100,
                Type = 1,
                MSG = "Press ~INPUT_CONTEXT~ to open the menu",
            },
            
            -- Blip Configuration
            Blip = {
                Sprite = 73,
                Display = 4,
                Scale = 1.0,
                Colour = 47,
                Name = "Clothing Store",
            },
        },
        -- Add more stores by adding [2], [3], etc.
    }
    ```

    <Tip>
      For finding precise coordinates, use the `/coords` command in-game if you have an admin resource installed, or use an online FiveM coordinate finder tool.
    </Tip>
  </Accordion>

  <Accordion title="Clothing Categories & Pricing">
    ### Item Configuration

    Define clothing categories, set default prices, and create specific overrides for individual items:

    ```lua theme={null}
    Config.Categories = {
        ["arms"] = { -- Category ID (must match game component names)
            Label = "Arms",  -- Display name in the menu
            Price = 321,     -- Default price for items in this category
            Overrides = {    -- Specific overrides for individual items
                ["5"] = {    -- Item ID (drawable ID) within this category
                    Gender = {"male", "female"}, -- Which gender(s) this applies to
                    Label = "Custom Arm Model 5", -- Custom display name
                    Price = 500,                 -- Custom price
                    Blocked = false,             -- If true, item cannot be purchased
                    AccesableFor = {             -- Job/gang restrictions (optional)
                        -- 'ambulance',
                        -- 'police',
                    },
                },
                -- Add more item overrides as needed
            }
        },
        -- Add more categories as needed (tshirt_1, pants_1, shoes_1, etc.)
    }
    ```

    <Info>
      Valid category IDs include: `arms`, `tshirt_1`, `torso_1`, `pants_1`, `shoes_1`, `bags_1`, `chain_1`, `helmet_1`, `glasses_1`, `watches_1`, `bracelets_1`, `mask_1`, `ears_1`, etc.

      Each category corresponds to a specific clothing component in the game. The item IDs (drawable IDs) must be valid for that component.
    </Info>
  </Accordion>
</AccordionGroup>

## 🚀 Pro Tips for Deep Customization

Take your clothing script setup to the next level with these advanced strategies:

* **Optimize Performance**: If you have numerous clothing stores, tweak `DrawDistance` in `Config.Locations` to balance visibility and resource load.
* **Boost Economy**: Leverage society payment options (`GiveOutfitOwnerMoney`, `GiveBuyClothingMoney`) to create dynamic revenue streams for player-run businesses or server funds.
* **Create Exclusive Stores**: Design job-specific or gang-affiliated boutiques by using `AccesableFor` in `Config.Categories` to restrict item purchases to certain groups.
* **Strategic Pricing Models**: Implement varied pricing for items and categories to influence your server's economy and player spending habits.
* **Theme Your Stores**: Use distinct blip icons, names, and marker colors for different store brands or types (e.g., high-end fashion, workwear, tactical gear).

<Callout>
  Remember to restart the resource (e.g., `restart rs_clothing`) or your entire
  FiveM server after making configuration changes for them to take effect.
</Callout>
