# Installation



{% hint style="info" %}
**Installation of the script**\
\
• Tutorials and explenations down below
{% endhint %}

**Importing inventory images to the store script:**\
**Location: scriptfolder/html/js/Shoptemp\_open.js**\
**Line: 39 and 40**

```javascript
// DO NOT COPY THIS LINE - OX Inventory Example
<img src="nui://ox_inventory/web/images/${name}.png" 
${isBlackMoney ? `data-tooltip="${tooltipText}"` : ''} />

// DO NOT COPY THIS LINE - QB - Inventory example
<img src="nui://qb-inventory/html/images/${name}.png"
${isBlackMoney ? `data-tooltip="${tooltipText}"` : ''} />

// For other inventories, set the line as shown above
<img src="nui://your-inventory-folder-name/whateverfolder/images-folder-name/${name}.imagetype"
${isBlackMoney ? `data-tooltip="${tooltipText}"` : ''} />
```

## Definitions and Explenations

<table><thead><tr><th>Config definition</th><th width="249">Explenation</th><th>Enable/Disable</th></tr></thead><tbody><tr><td>DisplayName</td><td>Store name shown in UI</td><td>-</td></tr><tr><td>PaymentID</td><td>Store sells and buys items in this payment ID (type)</td><td><p>• PaymentID = 1 --cash  /money<br><br>• PaymentID = 2 -- bank<br><br>• PaymentID = 3 -- black money</p><p></p></td></tr><tr><td>Distancetoseller</td><td>distance from how far will textui appear and shop can be opened, default is set to 1.5 units</td><td>-</td></tr><tr><td>Restartrefresh</td><td>if the shop stock should be refreshed back to default amounts after server/script restart</td><td>true/false</td></tr><tr><td>IsUnlimited</td><td>Should this store have stock limit? (if no limit you can buy or sell infinite amount of items defined in the config to this store)</td><td>true/false</td></tr><tr><td>Nobuying</td><td>Should this store have buy tab, if set to true, you are only able to sell items to this store, buying option is removed</td><td>true/false</td></tr><tr><td>Position</td><td>Position of the store, where you are able to open it and see the textui to open it.</td><td>-</td></tr><tr><td>BlipSettings</td><td>Can change store blip ID, size, colour and add name for the blip</td><td>BipSettings = false</td></tr><tr><td>SellerNPC</td><td>Can add desired ped to the store location, can make spawned ped play chosen animation. Also animation for the ped can be disabled.</td><td>• SellerNPC = false <br><br>• Animation = false<br><br>• Model = nil</td></tr><tr><td>Bprice</td><td>Price, that shop asks for the item.</td><td>• Static: Bprice = 57<br><br>• Random: Bprice = math.random(57, 60)<br><br>• Shop not buying the item:<br>Bprice = nil</td></tr><tr><td>Sprice</td><td>Price, that you will get for selling the item to the store.</td><td>• Static: Sprice = 57<br><br>• Random: Sprice = math.random(57, 60)<br><br>•Shop not selling the item:<br>Sprice = nil</td></tr><tr><td>Defaultamount</td><td>The amount of the item that store will start on first placement or after every data wipe, if Restartrefresh is set to true, or manually deleteing from the saveddata folder.</td><td>Can be set to 0, until someone sells the item to the store.</td></tr><tr><td>sellJob</td><td>The name of the jobs that can access this shop's sell option. Money goes to the society</td><td>sellJob = false or remove it from the list as examples down below do not have them in it</td></tr><tr><td>MaxAmount</td><td>Maximum amount of the item that store stock can hold. (Limits amount of items, that player can sell or buy from the store), every item maximum amount can be set separately.</td><td>If IsUnlimited is set to true,  then this store wont have stock limit at all, and from the shop placement items can be bought from there.</td></tr></tbody></table>

Store examples:

{% tabs %}
{% tab title="No Ped / No Blip" %}
{% code fullWidth="true" %}
```lua
--- Random and static price examples included as well 
--- (Bank Payment example can be changed from PaymentID)

Config.Storelist = {
['example-shop-no-ped-no-blip'] = { -- Shop ID
        DisplayName = "exampleshopnopednoblip", -- Name displayed for the shop
        PaymentID = 2, -- Payment Styles (selling and buying): 1 = cash, 2 = bank, 3 = black money
        Distancetoseller = 1.5,  --- Distance that opens TextUI and you are able to open the shop
        Restartrefresh = false, --- should store stock be wiped on server restart?
        IsUnlimited = false, -- Controls if items can be bought/sold without limit (stock)
        Nobuying = false,--- If true shop does not have buy option, you can only sell items there!
        Position = vector3(707.0936, -960.8204, 30.3953), -- Store location
        BlipSettings = false,
        SellerNPC = false,
        items = { -- Items available for sale or buying in the shop
            ['rolex'] = { -- Item name (same as used for item spawning, name, not label)
            ItemLabel = "Rolex", -- Label for the item
            Defaultamount = 2, --- Amount of this item that shop has by default
            BPrice = math.random(85, 105), -- Random buy price for the item (set this to nil you you do not want shop to sell this item)
            MaxAmount = 20, -- Maximum stock the shop can hold of this item
            SPrice = math.random(57, 77) -- Random sell price for the item (set this to nil if you do not want shop to buy this item)
            },
            ['gold_bar'] = { -- Item name (same as used for item spawning, name, not label
            ItemLabel = "Gold bar", -- Label  for the item
            Defaultamount = 2, --- Amount of this item that shop has by default
            BPrice = 85, -- Static buy price for the item (set this to nil you you do not want shop to sell this item)
            MaxAmount = 20, -- Maximum stock the shop can hold of this item
            SPrice = 77 -- Static sell price for the item (set this to nil if you do not want shop to buy this item)
            },
            ['bluediamond'] = { -- Item name (same as used for item spawning, name, not label
            ItemLabel = "Blue diamond", -- Label  for the item
            Defaultamount = 2, --- Amount of this item that shop has by default
            BPrice = math.random(85, 105), -- Random buy price for the item (set this to nil you you do not want shop to sell this item)
            MaxAmount = 20, -- Maximum stock the shop can hold of this item
            SPrice = nil -- If This is set to nil, then this item can not be sold to this store
            },
            ['pinkdiamond'] = { -- Item name (same as used for item spawning, name, not label
            ItemLabel = "Pink Diamond", -- Label for the item
            Defaultamount = 2, --- Amount of this item that shop has by default
            BPrice = nil, -- If This is set to nil, then this item can not be bought from this store
            MaxAmount = 20, -- Maximum stock the shop can hold of this item
            SPrice = 100-- If This is set to nil, then this item can not be sold to this store
            },
        },
    },
}


 
```
{% endcode %}
{% endtab %}

{% tab title="Ped / Blip" %}
```lua
--- (Cash/Money Payment example can be changed from PaymentID)

Config.Storelist = {
    ['cleanpwnshop'] = { -- Shop ID
    DisplayName = "Pawnshop", -- Name displayed for the shop
    PaymentID = 1, -- Payment Styles (selling and buying): 1 = cash, 2 = bank, 3 = black money
    Distancetoseller = 1.5,  --- Distance that opens TextUI and you are able to open the shop
    Restartrefresh = true, --- should store stock be wiped on server restart?
    IsUnlimited = false, -- Controls if items can be bought/sold without limit (stock)
    Nobuying = false,--- If true shop does not have buy option, you can only sell items there!
    Position = vector3(713.0685, -967.4807, 30.3953), -- Store location
    BlipSettings = { -- Blip creation (Set this as false if you do not want a blip)
        SpriteID = 272, -- Sprite ID for the blip
        ScaleFactor = 1.0, -- Size of the blip on the map
        StoreBlipName = "Pawnshop" --- Blip name
    },
    SellerNPC = { -- Seller NPC Configuration 
        Model = 'cs_carbuyer', -- NPC model (set to nil if you do not want to have a ped)
        Location = vector3(713.0685, -967.4807, 29.3953), -- NPC Spawn location
        HeadingDirection = 349.6501, -- NPC Heading
        Animation = {
            Dict = "amb@world_human_hang_out_street@female_arms_crossed@idle_a", -- Animation dictionary for NPC
            Name = "idle_a" -- Name of the animation to play
        }
    },
    items = { -- Items available for sale or buying in the sho
        ['goldbull'] = { -- Item name (same as used for item spawning, name, not label
        ItemLabel = "Gold coins", -- Label for the item
        Defaultamount = 2, --- Amount of this item that shop has by default
        BPrice = math.random(85, 105), -- Random buy price for the item (set this to nil you you do not want shop to sell this item)
        MaxAmount = 20, -- Maximum stock the shop can hold of this item
        SPrice = math.random(57, 77) -- Random sell price for the item (set this to nil if you do not want shop to buy this item)
        },
        ['gold_bar'] = { -- Item name (same as used for item spawning, name, not labeln
        ItemLabel = "Gold bar", -- Label for the item
        Defaultamount = 2, --- Amount of this item that shop has by default
        BPrice = math.random(85, 105), -- Random buy price for the item (set this to nil you you do not want shop to sell this item)
        MaxAmount = 20, -- Maximum stock the shop can hold of this item
        SPrice = math.random(57, 77) -- Random sell price for the item (set this to nil if you do not want shop to buy this item)
        },
        ['bluediamond'] = { -- Item name (same as used for item spawning, name, not label
        ItemLabel = "Blue diamond", -- Label for the item
        Defaultamount = 2, --- Amount of this item that shop has by default
        BPrice = math.random(85, 105), -- Random buy price for the item (set this to nil you you do not want shop to sell this item)
        MaxAmount = 20, -- Maximum stock the shop can hold of this item
        SPrice = math.random(57, 77) -- Random sell price for the item (set this to nil if you do not want shop to buy this item)
        },
        ['diamond'] = { -- Item name (same as used for item spawning, name, not label
        ItemLabel = "Diamond", -- Label for the item
        Defaultamount = 2, --- Amount of this item that shop has by default
        BPrice = math.random(85, 105), -- Random buy price for the item (set this to nil you you do not want shop to sell this item)
        MaxAmount = 20, -- Maximum stock the shop can hold of this item
        SPrice = math.random(57, 77) -- Random sell price for the item (set this to nil if you do not want shop to buy this item)
        },
        ['pinkdiamond'] = { -- Item name (same as used for item spawning, name, not label
        ItemLabel = "Pink diamond", -- Label for the item
        Defaultamount = 2, --- Amount of this item that shop has by default
        BPrice = math.random(85, 105), -- Random buy price for the item (set this to nil you you do not want shop to sell this item)
        MaxAmount = 20, -- Maximum stock the shop can hold of this item
        SPrice = math.random(57, 77) -- Random sell price for the item (set this to nil if you do not want shop to buy this item)
        },
        ['panther'] = { -- Item name (same as used for item spawning, name, not label
        ItemLabel = "Panther statue", -- Label for the item
        Defaultamount = 2, --- Amount of this item that shop has by default
        BPrice = math.random(85, 105), -- Random buy price for the item (set this to nil you you do not want shop to sell this item)
        MaxAmount = 20, -- Maximum stock the shop can hold of this item
        SPrice = math.random(57, 77) -- Random sell price for the item (set this to nil if you do not want shop to buy this item)
        },
        ['pbottle'] = { -- Item name (same as used for item spawning, name, not label
        ItemLabel = "Expensive bottle", -- Label for the item
        Defaultamount = 2, --- Amount of this item that shop has by default
        BPrice = math.random(85, 105), -- Random buy price for the item (set this to nil you you do not want shop to sell this item)
        MaxAmount = 20, -- Maximum stock the shop can hold of this item
        SPrice = math.random(57, 77) -- Random sell price for the item (set this to nil if you do not want shop to buy this item)
        },
        ['pnecklace'] = { -- Item name (same as used for item spawning, name, not label
        ItemLabel = "Expensive necklace", -- Label for the item
        Defaultamount = 2, --- Amount of this item that shop has by default
        BPrice = math.random(85, 105), -- Random buy price for the item (set this to nil you you do not want shop to sell this item)
        MaxAmount = 20, -- Maximum stock the shop can hold of this item
        SPrice = math.random(57, 77) -- Random sell price for the item (set this to nil if you do not want shop to buy this item)
        },
        ['pmonkey'] = { -- Item name (same as used for item spawning, name, not label
        ItemLabel = "Monkey statue", -- Label for the item
        Defaultamount = 2, --- Amount of this item that shop has by default
        BPrice = math.random(85, 105), -- Random buy price for the item (set this to nil you you do not want shop to sell this item)
        MaxAmount = 20, -- Maximum stock the shop can hold of this item
        SPrice = math.random(57, 77) -- Random sell price for the item (set this to nil if you do not want shop to buy this item)
        },
        ['necklace'] = { -- Item name (same as used for item spawning, name, not label
        ItemLabel = "Necklace", -- Label for the item
        Defaultamount = 2, --- Amount of this item that shop has by default
        BPrice = math.random(85, 105), -- Random buy price for the item (set this to nil you you do not want shop to sell this item)
        MaxAmount = 20, -- Maximum stock the shop can hold of this item
        SPrice = math.random(57, 77) -- Random sell price for the item (set this to nil if you do not want shop to buy this item)
        },
        ['ring'] = { -- Item name (same as used for item spawning, name, not label
        ItemLabel = "Ring", -- Label for the item
        Defaultamount = 2, --- Amount of this item that shop has by default
        BPrice = math.random(85, 105), -- Random buy price for the item (set this to nil you you do not want shop to sell this item)
        MaxAmount = 20, -- Maximum stock the shop can hold of this item
        SPrice = math.random(57, 77) -- Random sell price for the item (set this to nil if you do not want shop to buy this item)
        },
        ['rolex'] = { -- Item name (same as used for item spawning, name, not label
        ItemLabel = "Rolex", -- Label for the item
        Defaultamount = 2, --- Amount of this item that shop has by default
        BPrice = math.random(85, 105), -- Random buy price for the item (set this to nil you you do not want shop to sell this item)
        MaxAmount = 20, -- Maximum stock the shop can hold of this item
        SPrice = math.random(57, 77) -- Random sell price for the item (set this to nil if you do not want shop to buy this item)
        },
      },
   },
}
```
{% endtab %}

{% tab title="Ped/Blip Dirty" %}
```lua
--- (Black money Payment example can be changed from PaymentID)

Config.Storelist = {
    ['shadypawnshop'] = { -- Shop ID
        DisplayName = "Dirty Pawnshop", -- Name displayed for the shop
        PaymentID = 3, -- Payment Styles (selling and buying): 1 = cash, 2 = bank, 3 = black money
        Distancetoseller = 1.5,  --- Distance that opens TextUI and you are able to open the shop
        Restartrefresh = false, --- should store stock be wiped on server restart?
        IsUnlimited = false, -- Controls if items can be bought/sold without limit (stock)
        Nobuying = true,--- If true shop does not have buy option, you can only sell items there!
        Position = vector3(706.1038, -965.5582, 30.4129), -- Store location
        BlipSettings = { -- Blip creation (Set this as false if you do not want a blip)
            ColorID = 1, -- Color for the shop blip
            SpriteID = 272, -- Sprite ID for the blip
            ScaleFactor = 1.0, -- Size of the blip on the map
            StoreBlipName = "Dirty Pawnshop" --- Blip name
        },
        SellerNPC = { -- Seller NPC Configuration 
            Model = 'a_m_y_soucent_02', -- NPC model (set to nil if you do not want to have a ped)
            Location = vector3(706.1038, -965.5582, 29.4129), -- NPC Spawn location
            HeadingDirection = 285.1291, -- NPC Heading
            Animation = {
                Dict = "amb@world_human_aa_smoke@male@idle_a", -- Animation dictionary for NPC
                Name = "idle_a" -- Name of the animation to play
            }
        },
        items = { -- Items available for sale or buying in the shop
            ['goldbull'] = { -- Item name (same as used for item spawning, name, not label
            ItemLabel = "Gold coins", -- Label for the item
            Defaultamount = 2, --- Amount of this item that shop has by default
            BPrice = math.random(85, 105), -- Random buy price for the item (set this to nil you you do not want shop to sell this item)
            MaxAmount = 20, -- Maximum stock the shop can hold of this item
            SPrice = math.random(57, 77) -- Random sell price for the item (set this to nil if you do not want shop to buy this item)
            },
            ['gold_bar'] = { -- Item name (same as used for item spawning, name, not label
            ItemLabel = "Gold bar", -- Label for the item
            Defaultamount = 2, --- Amount of this item that shop has by default
            BPrice = math.random(85, 105), -- Random buy price for the item (set this to nil you you do not want shop to sell this item)
            MaxAmount = 20, -- Maximum stock the shop can hold of this item
            SPrice = math.random(57, 77) -- Random sell price for the item (set this to nil if you do not want shop to buy this item)
            },
        },
    },
}
```
{% endtab %}

{% tab title="selljob ESX only" %}
```lua
Config.Storelist = {
['jobexample'] = {
        DisplayName = "BurgerShot",
        sellJob = {'burgershot'}, -- The name of the jobs that can access this shop's sell option. Money goes to the society
        Position = vector3(-1198.8856201172, -882.81433105469, 13.348832130432),
        BlipSettings = { -- Blip creation (set this to false if do not want a blip)
        ColorID = 75, -- Color for the shop blip
        SpriteID = 103, -- Sprite ID for the blip
        ScaleFactor = 1.0, -- Size of the blip on the map
        StoreBlipName = "Burgershot" --- Blip name
    },
        SellerNPC = { -- Seller NPC Configuration 
        Model = 'csb_burgerdrug', -- NPC model (set to nil if you do not want to have a ped)
        Location = vector3(-1198.7757568359, -882.98065185547, 12.349102020264), -- NPC Spawn location
        HeadingDirection = 34.899082183838, -- NPC Heading
        Animation = {
            Dict = "amb@world_human_hang_out_street@female_arms_crossed@idle_a", -- Animation dictionary for NPC
            Name = "idle_a" -- Name of the animation to play
        }
    },
        PaymentID = 1,
        items = {
            ['sandwich'] = {
                ItemLabel = "Sandwich",
                Defaultamount = 50,
                BPrice = 200,
                MaxAmount = 50,
                SPrice = 150,
            },
            ['cola'] = {
                label = "Cola",
                Defaultamount = 50,
                BPrice = 50,
                MaxAmount = 50,
                SPrice = 10,
            },
        }
    },
}
```
{% endtab %}
{% endtabs %}

## Built to update and extend shops system created by: [K5](https://github.com/kac5a/k5_shops)
