# Snippets

### Item Snippets

Here are item snippets to add to your items/framework.

{% tabs %}
{% tab title="ox" %}

```lua
    ['boosterpack'] = {
		label  = 'Booster Pack',
		weight = 2,
		consume = 1,
    		metadata = {},
		client = {export = 't3_tradingcards.boosterpack'},
		stack = true,
		close = true,
		description = ''
	},

    ['album'] = {
		label  = 'Album',
		weight = 2,
		consume = 0,
    		metadata = {},
		client = {export = 't3_tradingcards.album'},
		stack = true,
		close = true,
		description = ''
	},

    ['tradingcard'] = {
		label  = 'Trading Card',
		weight = 2,
		consume = 0,
    		metadata = {},
		client = {export = 't3_tradingcards.useCard'},
		buttons = {{label='Add to album',action=function(slot) TriggerServerEvent('t3_tradingcards:passCard',slot) end}},
		stack = true,
		close = true,
		description = ''
	},
```

{% endtab %}

{% tab title="qb" %}

```lua
    ['boosterpack'] = { ['name'] = 'boosterpack', ['label'] = 'boosterpack', ['weight'] = 2, ['type'] = 'item', ['image'] = 'boosterpack.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'boosterpack'},
    ['album'] = { ['name'] = 'album', ['label'] = 'album', ['weight'] = 2, ['type'] = 'item', ['image'] = 'album.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'album'},
    ['tradingcard'] = { ['name'] = 'tradingcard', ['label'] = 'tradingcard', ['weight'] = 2, ['type'] = 'item', ['image'] = 'tradingcard.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'tradingcard'},
```

{% endtab %}

{% tab title="qs" %}

```lua
    ['boosterpack'] = { ['name'] = 'boosterpack', ['label'] = 'boosterpack', ['weight'] = 2, ['type'] = 'item', ['image'] = 'boosterpack.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'boosterpack'},
    ['album'] = { ['name'] = 'album', ['label'] = 'album', ['weight'] = 2, ['type'] = 'item', ['image'] = 'album.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'album'},
    ['tradingcard'] = { ['name'] = 'tradingcard', ['label'] = 'tradingcard', ['weight'] = 2, ['type'] = 'item', ['image'] = 'tradingcard.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'tradingcard'},
```

{% endtab %}
{% endtabs %}

### Shop Snippets

Here are some snippets to add items to your shops.

{% tabs %}
{% tab title="ox" %}

```lua
{ name = 'boosterpack', price = 10, metadata = { pack = 'gta', image = 'gtaboosterpack' } },
{ name = 'album', price = 100, metadata = { pack = 'gta', image = 'gtaalbum' } },
{ name = 'boosterpack', price = 10, metadata = { pack = 'pokemon', image = 'pokemonboosterpack' } },
{ name = 'album', price = 100, metadata = { pack = 'pokemon', image = 'pokemonalbum' } },
```

{% endtab %}

{% tab title="qb" %}

```lua
    [1] = {
        name = "boosterpack",
        price = 10,
        amount = 100,
        info = {pack="gta",image="gtaboosterpack.png",label="gtaboosterpack"},
        type = "item",
        slot = 1,
    },
    [2] = {
        name = "album",
        price = 100,
        amount = 20,
        info = {pack="gta",image="gtaalbum.png",label="gtaalbum"},
        type = "item",
        slot = 2,
    },
    [3] = {
        name = "boosterpack",
        price = 10,
        amount = 100,
        info = {pack="pokemon",image="pokemonboosterpack.png",label="pokemonboosterpack"},
        type = "item",
        slot = 3,
    },
    [4] = {
        name = "album",
        price = 100,
        amount = 20,
        info = {pack="pokemon",image="pokemonalbum.png",label="pokemonalbum"},
        type = "item",
        slot = 4,
    },
```

{% endtab %}

{% tab title="qs" %}

```lua
    [4] = {
        name = "boosterpack",
        label = 'Booster Pack',
        price = 250,
        amount = 100,
        info = {pack="gta", image="gtaboosterpack", label="GTA Booster Pack"},
        type = "item",
        slot = 4,
    },
    [5] = {
        name = "album",
        label = 'Album',
        price = 250,
        amount = 100,
        info = {pack="gta", image="gtaalbum", label="GTA Album"},
        type = "item",
        slot = 5,
    },
    [6] = {
        name = "boosterpack",
        label = 'Booster Pack',
        price = 250,
        amount = 100,
        info = {pack="pokemon", image="pokemonboosterpack", label="Pokemon Booster Pack"},
        type = "item",
        slot = 6,
    },
    [7] = {
        name = "album",
        label = 'Album',
        price = 250,
        amount = 100,
        info = {pack="pokemon", image="pokemonalbum", label="Pokemon Album"},
        type = "item",
        slot = 7,
    },
```

{% endtab %}

{% tab title="mf" %}

```lua
	{
		name = "boosterpack",
		label = "GTA Booster Pack",
		price = 100,
		weight = 2.0,
		mdGenerators = {
			MDGenerators.Img("gtaboosterpack"),
			MDGenerators.Desc("GTA Booster Pack"),
			MDGenerators.Pack("gta"),
		},
		metadata = {
			["pack"] = "gta",
			["ImageUrl"] = "gtaboosterpack",
			["OverwriteDesc"] = "GTA Booster Pack",
		}
	},
	{
		name = "album",
		label = "GTA Album",
		price = 200,
		weight = 2.0,
		mdGenerators = {
			MDGenerators.Img("gtaalbum"),
			MDGenerators.Desc("GTA Album"),
			MDGenerators.Pack("gta"),
		},
		metadata = {
			["pack"] = "gta",
			["ImageUrl"] = "gtaalbum",
			["OverwriteDesc"] = "GTA Album",
		}
	},
	{
		name = "boosterpack",
		label = "Pokemon Booster Pack",
		price = 100,
		weight = 2.0,
		mdGenerators = {
			MDGenerators.Img("pokemonboosterpack"),
			MDGenerators.Desc("Pokemon Booster Pack"),
			MDGenerators.Pack("pokemon"),
		},
		metadata = {
			["pack"] = "pokemon",
			["ImageUrl"] = "pokemonboosterpack",
			["OverwriteDesc"] = "Pokemon Booster Pack",
		}
	},
	{
		name = "album",
		label = "Pokemon Album",
		price = 200,
		weight = 2.0,
		mdGenerators = {
			MDGenerators.Img("pokemonalbum"),
			MDGenerators.Desc("Pokemon Album"),
			MDGenerators.Pack("pokemon"),
		},
		metadata = {
			["pack"] = "pokemon",
			["ImageUrl"] = "pokemonalbum",
			["OverwriteDesc"] = "Pokemon Album",
		}
	},
```

Add these to your **mdgenerators.lua**

```lua
	MDGenerators.Img = function(img)
		return function()
			return "ImageUrl",img
		end
	end

	MDGenerators.Desc = function(desc)
		return function()
			return "OverwriteDesc",desc
		end
	end

	MDGenerators.Pack = function(pack)
		return function()
			return "pack",pack
		end
	end
```

{% endtab %}
{% endtabs %}

### Exports

If you enable the Config.Selling.useExport option, this will disable npc/marker selling, allowing you to control who can do this or or how they do it.\
Here's an example of how to do that for ox\_target:

```lua
exports['ox_target']:addBoxZone({
    coords = vec3(442.5363, -1017.666, 28.85637),
    size = vec3(3, 3, 3),
    options = {
        {
            name = 'sellAlbums',
            groups = 'comic',
            icon = 'fa-solid fa-book-open',
            label = 'Open Sell Menu',
            onSelect = function()
                exports['t3_tradingcards']:openSellMenu()
            end
        }
    }
})
```
