> For the complete documentation index, see [llms.txt](https://titans-productions.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://titans-productions.gitbook.io/documentation/redm/scripts/stores.md).

# Stores

### Add your inventory images

For changing the inventory images path, is the `Config.InventoryImgPath` configuration option.\
\
Click [here](https://titans-productions.gitbook.io/documentation/redm/important-information-read-me#loading-inventory-images) to read all the information related to inventory images and our scripts to understand properly of how everything works in case you cannot understand or having any issues.

### How to add webhooks?

For enabling the webhooks, the configuration option is the `Config.DiscordWebhooking` .

Click [here](https://titans-productions.gitbook.io/documentation/redm/how-to-add-webhooks) to read all the information related of how webhooks are functional and how to setup.

### How to create your own store and manage it

For creating your own store, the configuration section is the `Config.Stores` where you can create custom stores to open through an export or create stores that do not need any exports  and can be opened by everyone, specific jobs or groups.

1. `IsCustom` - this option if enabled, all the rest options such as `Coords`, `BlipData`, `NPCData`, `Hours`, `RequiredJobs`, `RequiredGroups` , `RequiredDays` , `HasTarget` , `TargetIcon` and literally all options except `StoreName`, `IsCustom` , `Categories` and `StoreProductsPackage` will **not** be functional - as mentioned, this option is for opening a store through an export (For developers or people who have some basic knowledge).
2. `Coords` - this option is where the store blip will be displayed (if enabled), including the prompt action for opening the store.
3. `DistanceOpenStore`  - this option for the radius for opening the store through a prompt action or target-eye support.
4. `BlipData`  - this option if enabled, is creating the desired blip on `Coords` . \
   \
   \- The `OpenBlipModifier` is a color modifier for the blip when the store is not closed.\
   \
   \- The `DisplayClosedHours` is a modifier for the blip when the store is closed which has the options to change the blip sprite during closed hours and the color.\
   \
   \- The `OnlyJobs` is to allow only specific jobs to be able to see this store blip.\
   \
   \- The `OnlyGroups` is to allow only specific jobs to be able to see this store blip.
5. `NPCData` - this option if enabled, created an npc model on the desired `Coords` location.
6. `Hours` - this option if enabled, it allows you to create opening and closing store hours (in-game hours).
7. `RequiredJobs` - this option is for the store to become visible only for specific jobs and anyone else.
8. `RequiredGroups` - this option is for the store to become visible only for specific groups and not anyone else.
9. `RequiredDays` - this option is for the store to become active during specific real-days, for example every `Friday` or every `Tuesday` or having multiple days instead of one.
10. `HasTarget` - this option is for the store to be using an `ox-target` support and `TargetIcon` is for the action font-awesome icon.
11. `StoreProductsPackage` - this is a very important option which requires the created store package that will be or already is located on `Config.StoreProductPackages` . You can either create new store product packages or use existing ones (for example general stores, you might want the same products, so thats a time-saver).\
    \
    Lets use as an example the `hunting_store` as `StoreProductsPackage` which also exists by default on the store configuration file.
12. `Categories` - last and most important is the categories that will be visible when opening the `StoreProductsPackage` . Those categories **MUST** exist, you don't create them randomly, they have to be on the `Config.StoreProductPackages` where the `StoreProductsPackage` is named to. \
    \
    Lets says by default that we have these:<br>

    ```lua
    Categories = { 
        { category = "hunting",  types = {"sell", "exchange"} },
        { category = "trapped birds",  types = {"sell"} },
        { category = "trapped small animals",  types = {"sell"} },
        { category = "trapped reptiles",  types = {"sell"} },
    }, 
    ```

These are the packages that we want to have for our store, we have made as first section a hunting for selling and exchanging, a trapped birds, small animals and reptiles selling section (for example selling animal (items) that you have hunted and killed and now you want to sell the received items).\
\
Now, lets move to `Config.StoreProductPackages` section which is the hardest part to understand and work for begginers. \
\
We create the new `StoreProductsPackage` inside `Config.StoreProductsPackages` configuration option.\ <br>

```lua
---------------------------------------------------------------
-- ["buy"]:
-- 1. canGiveItems: The specified category type does NOT CONTAIN this option `canGiveItems`, it is ONLY for selling.

-- 2. jobs: The specified option requires a list (table) parameter such as jobs = { "police", "police2" }, otherwise set it to false or null.

-- 3. limit: By having the limit to false, the buying limit is infinite - unlimited, otherwise, there will be a limit quantity to buy this product on every restart.

-- 4. dynamic: This feature is connected with @limit, the difference is by using dynamic, if this product exists on the same store for selling, it will be adding the selling quantity
-- back to the product on the buying category catalog (if exists).
---------------------------------------------------------------

---------------------------------------------------------------
-- ["sell"]:
-- 1. canGiveItems: Set to true if you want to give extra items as "rewards" when selling a product.

-- The specified option requires a list (table) parameters on givenItem = {}, givenAmount = {}, givenDisplay = {}.
-- For example, if you want to give a fur: 

-- canGiveItems = true,
-- givenItem    = { "fur"}   <- ITEM NAME            
-- givenAmount  = { 1 }      <- QUANTITY
-- givenDisplay = { "Fur" }  <- LABEL DISPLAY     

-- If you want to add more rewards, you have to include a comma and based on the new reward item, you also have to add the amount and the label display.

-- 2. jobs: The specified option requires a list parameter such as jobs = { "police", "police2" }, otherwise set it to false or null.


-- 3. limit: By having the limit to false, the sell limit is infinite - unlimited, otherwise, there will be a limit quantity to sell this product on every restart.

-- 4. dynamic: ^^

---------------------------------------------------------------

---------------------------------------------------------------
-- ["exchange"]:
-- 1. canGiveItems: The specified category type does NOT CONTAIN this option `canGiveItems`, it is ONLY for selling.

-- 2. jobs: The specified option requires a list (table) parameter such as jobs = { "police", "police2" }, otherwise set it to false or null.

-- 3. id: The specified parameter is REQUIRED to have an index order in case you are having multiple exchanges based on an item.
---------------------------------------------------------------

Config.StoreProductPackages = {

    ['hunting_store'] = {

        ['sell'] = {
        
            { label = "Fibers",                      item = "fibers",                      currency = "dollars",   price = 0.20, canGiveItems = false, givenItem = {},                         givenAmount = {},            givenDisplay = {},                        category = "hunting" },
            { label = "Leather",                     item = "leather",                     currency = "dollars",   price = 0.30, canGiveItems = false, givenItem = {},                         givenAmount = {},            givenDisplay = {},                        category = "hunting" },
            { label = "Feathers",                    item = "feathers",                    currency = "dollars",   price = 0.40, canGiveItems = false, givenItem = {},                         givenAmount = {},            givenDisplay = {},                        category = "hunting" },
            { label = "Fabric",                      item = "fabric",                      currency = "dollars",   price = 0.60, canGiveItems = false, givenItem = {},                         givenAmount = {},            givenDisplay = {},                        category = "hunting" },
            { label = "Snake Skin",                  item = "snake_skin",                  currency = "dollars",   price = 0.60, canGiveItems = false, givenItem = {},                         givenAmount = {},            givenDisplay = {},                        category = "hunting" },

            { label = "Fur",                         item = "fur",                         currency = "dollars",   price = 0.7,  canGiveItems = false, givenItem = {},                         givenAmount = {},            givenDisplay = {},                        category = "hunting" },
            { label = "Pelt",                        item = "pelt",                        currency = "dollars",   price = 0.7,  canGiveItems = false, givenItem = {},                         givenAmount = {},            givenDisplay = {},                        category = "hunting" },
            { label = "Bird Meat",                   item = "birdmeat",                    currency = "dollars",   price = 0.8,  canGiveItems = false, givenItem = {},                         givenAmount = {},            givenDisplay = {},                        category = "hunting" },
            { label = "Fish Meat",                   item = "fish_meat",                   currency = "dollars",   price = 0.9,  canGiveItems = false, givenItem = {},                         givenAmount = {},            givenDisplay = {},                        category = "hunting" },
            { label = "Meat",                        item = "meat",                        currency = "dollars",   price = 0.9,  canGiveItems = false, givenItem = {},                         givenAmount = {},            givenDisplay = {},                        category = "hunting" },
            { label = "Big Game Meat",               item = "biggame",                     currency = "dollars",   price = 1.0,  canGiveItems = false, givenItem = {},                         givenAmount = {},            givenDisplay = {},                        category = "hunting" },
            { label = "Bison Meat",                  item = "bison_meat",                  currency = "dollars",   price = 1.2,  canGiveItems = false, givenItem = {},                         givenAmount = {},            givenDisplay = {},                        category = "hunting" },

            -- Trapped Animals

            -- [BIRDS]
            { label = "Crow",                        item = "a_c_crow_01",                 currency = "dollars",   price = 0.50, canGiveItems = true,  givenItem = { "birdmeat", "feathers" }, givenAmount = { 1, {1, 3} }, givenDisplay = {"Bird Meat", "Feathers"}, category = "trapped birds" },
            { label = "Songbird",                    item = "a_c_songbird_01",             currency = "dollars",   price = 0.50, canGiveItems = true,  givenItem = { "birdmeat", "feathers" }, givenAmount = { 1, {1, 3} }, givenDisplay = {"Bird Meat", "Feathers"}, category = "trapped birds" },
            { label = "Sparrow",                     item = "a_c_sparrow_01",              currency = "dollars",   price = 0.50, canGiveItems = true,  givenItem = { "birdmeat", "feathers" }, givenAmount = { 1, {1, 3} }, givenDisplay = {"Bird Meat", "Feathers"}, category = "trapped birds" },

            -- [SMALL ANIMALS]
            { label = "Rat",                         item = "a_c_rat_01",                  currency = "dollars",   price = 0.60, canGiveItems = true,  givenItem = { "fur"},                   givenAmount = { 1 },         givenDisplay = {"Fur"},                   category = "trapped small animals" },
            { label = "Chipmunk",                    item = "a_c_chipmunk_01",             currency = "dollars",   price = 0.60, canGiveItems = true,  givenItem = { "fur"},                   givenAmount = { 1 },         givenDisplay = {"Fur"},                   category = "trapped small animals" },
            { label = "Skunk",                       item = "a_c_skunk_01",                currency = "dollars",   price = 0.60, canGiveItems = true,  givenItem = { "fur"},                   givenAmount = { 1 },         givenDisplay = {"Fur"},                   category = "trapped small animals" },
 
            -- [REPTILES]
            { label = "Frogbull",                    item = "a_c_frogbull_01",             currency = "dollars",   price = 0.65, canGiveItems = false, givenItem = {},                         givenAmount = {},            givenDisplay = {},                        category = "trapped reptiles" },
            { label = "Toad",                        item = "a_c_toad_01",                 currency = "dollars",   price = 0.65, canGiveItems = false, givenItem = {},                         givenAmount = {},            givenDisplay = {},                        category = "trapped reptiles" },

        },

        ['exchange'] = {

            { id = 1, label = "Fibers (X2)",         item = "fibers",                      currency = "exchange",  price = 1,  requiredItem = "feathers",   requiredItemLabel = "Feathers",       givenAmount = 2, category = "hunting" },
            { id = 2, label = "Jerky (X2)",          item = "jerky",                       currency = "exchange",  price = 1,  requiredItem = "bison_meat", requiredItemLabel = "Bison Meat",     givenAmount = 2, category = "hunting" },
            
        },

    },
```

Now, as you see, we have created `sell` and `exchange` categories inside our product package `hunting_store` - those are the categories that we used on `Categories.`

Inside on every category, we must define what items we want to sell or exchange with the prices and the costs we want, but what you have to focus mostly is the `category` inside every item that you add, this `category` is the one that is going to be displayed on `Categories` that we made.\
\
For example, we have made `trapped birds`, then on selling we create what items we want the players to sell inside this package and category, but we also want to display what `category` it is going to be located on. So the `category` on every item is required in order to display on the correct category section because the `sell` category is general which holds all items, you don't create multiple `sell` categories inside the `package`, but you create one instead and when adding the items, you define on which `category` they are going to be displayed to.
