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

# Stores

<figure><img src="/files/AkmfiTphTlosd4g8sOky" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/iZUplxWAKAJzG79FeemK" alt=""><figcaption></figcaption></figure>

{% hint style="danger" %}
Dependencies:

Renewed Lib: <https://github.com/Renewed-Scripts/Renewed-Lib/releases/tag/v2.0.7>

Ox Lib: <https://github.com/overextended/ox_lib/releases>
{% endhint %}

## Shop Creation

```lua
['Store Name'] = {
    ped = { 
        model = `s_m_m_gaffer_01`, 
        scenario = 'WORLD_HUMAN_AA_SMOKE', 
    },
    target = { 
        label = 'Talk',
        distance = 3.0,
    },
    blip = { 
        show = boolean, 
        sprite = sprite_id, 
        color = color_id, 
        scale = scale_value, 
    },
    itemRestockTime = 30,
    paymentMethods = {
                ['cash'] = {
                    label = 'Cash',
                    icon = 'fa-solid fa-wallet',
                },
                ['bank'] = {
                    label = 'Bank',
                    icon = 'fas fa-university',
                },
            },
    locations = {
        [1] = {
            coords = vector4(x, y, z, heading),
            itemType = 'tools',
            businessHours = {
                openTime = 0,
                closeTime = 24,
            }
        },
    },
},
```

{% hint style="warning" %}
You **Cannot** have both target and drawText parameters for a store
{% endhint %}

{% hint style="warning" %}
Please note that for items to be accepted as a payment option it must be defined as isItem
{% endhint %}

* ped: `table`
  * model: `hash` Ped model identifier
  * scenario: `string` Scenario name for the ped
* target: `table`
  * label: `string` Label for the target interaction
  * distance: `number` Distance for the target interaction
* drawText: `table`
  * label: `string`  Label for the drawText
  * distance: Distance for the drawText
  * openKey: `string`  Key to open the drawText
* blip: `table`
  * show: `boolean` show or hide the blip
  * sprite: `number`  Sprite ID for the blip
  * color: `number` Color ID for the blip
  * scale: `number` Scale value for the blip
* paymentMethods: `table`
  * \['payment']: `table` Each key is a payment method (eg. 'cash', 'bank')
    * label: `string` display name for the payment method
    * icon: `string` icon for the payment method
    * isItem: `bool` for payment with items
    * useWorth: `bool` if true it uses the the metadata worth of the item else uses item count
* itemRestockTime: `number` time in minutes to restock items
* locations: `table`
  * coords: `vector4` Coordinates and heading for the location (vector4)
  * itemType:`string`  Type of items available at this location
  * businessHours: `table` Time the store is accessible
    * openTime: `number`
    * closeTime: `number`

## Discount Codes

```lua
['police'] = {
  discount = 50, -- 50% discount
  code = 'police10', -- discount code
}
```

* \[job\_name]: Job needed for the discount code to be used and applied
  * discount: The percentage discount for the job (e.g., 50 for 50% discount).
  * code: The discount code associated with the job (e.g., 'police10')
