> For the complete documentation index, see [llms.txt](https://code-after-sex.gitbook.io/script-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://code-after-sex.gitbook.io/script-documentation/cas-owned-shops/general-stores.md).

# NPC General Stores

Set up NPC general stores in CAS Owned Shops: shopkeeper, map blip, logo and item list for each fixed store in config/shared\_config.lua.

General stores are fixed shops that you define in `Config.DefaultShops`. Each one gets a shopkeeper NPC and a map blip. When a player comes within 3 metres of the shopkeeper, the **Open Shop** prompt appears, and **G** opens the store.

General stores never run out. An item's `count` is the most a player can put in the basket in one purchase. The money is taken from the player's cash and does not go to anyone.

## Adding a store

Every entry in `Config.DefaultShops` is one store:

```lua
Config.DefaultShops = {
    [1] = {
        shopSettings = {
            shopName = "Valentine Store",
            defaultLogourl = "https://your-cdn.example/logo.png",
        },
        blipSettings = {
            blipSpriteHash = "blip_shop_market_stall",
            blipScale = "0.2",
            blip = nil,
            blipCoords = {x = 1298.19, y = -1149.73, z = 81.1},
        },
        pedSettings = {
            enablePed = true,
            ped = nil,
            pedHash = "MSP_GANG2_MALES_01",
            coords = {x = 1298.19, y = -1149.73, z = 81.1, h = 300.0},
        },
        items = {
            { name = "bandage", label = "Bandage", price = 40, count = 2000, category = "misc" },
            { name = "WEAPON_MELEE_KNIFE", label = "Knife", price = 40, count = 2000, category = "weapons" },
            { name = "consumable_coffee", label = "Coffee", price = 12, count = 2000, category = "consumables" },
        },
    },
}
```

| Field                                  | What it does                                                                   |
| -------------------------------------- | ------------------------------------------------------------------------------ |
| `shopSettings.shopName`                | Name shown on the store screen and on the map blip.                            |
| `shopSettings.defaultLogourl`          | Image shown as the store logo.                                                 |
| `blipSettings.blipSpriteHash`          | Blip icon name, for example `blip_shop_market_stall`.                          |
| `blipSettings.blipScale`               | Blip size.                                                                     |
| `blipSettings.blipCoords`              | Where the blip sits on the map.                                                |
| `blipSettings.blip`, `pedSettings.ped` | Filled in by the script at runtime. Leave them as `nil`.                       |
| `pedSettings.enablePed`                | `false` hides the shopkeeper. The prompt still works at `coords`.              |
| `pedSettings.pedHash`                  | Shopkeeper model.                                                              |
| `pedSettings.coords`                   | Shopkeeper position and heading (`h`). The prompt range is measured from here. |
| `items`                                | What the store sells.                                                          |

Each line in `items` takes:

| Field      | What it does                                                                 |
| ---------- | ---------------------------------------------------------------------------- |
| `name`     | The inventory item name. A name that contains `WEAPON` is given as a weapon. |
| `label`    | Name shown in the store.                                                     |
| `price`    | Price for one.                                                               |
| `count`    | The most a player can buy in one purchase.                                   |
| `category` | One of the ids in `Config.ItemCategories`, used by the category filter.      |

{% hint style="warning" %}
The config ships with two sample stores at the same position. Move them to your own locations, or delete the one you don't need.
{% endhint %}
