# RD Black market

{% embed url="<https://www.youtube.com/watch?v=5-Q8B4Tmf2Q>" %}

## Step 1 - Add item

Think this exist by default but if not add the following.

```lua
['laptop'] 				 		 = {['name'] = 'laptop', 			  	  		['label'] = 'Laptop', 					['weight'] = 4000, 		['type'] = 'item', 		['image'] = 'laptop.png', 				['unique'] = false, 	['useable'] = true, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = 'Expensive laptop'},
```

## Step 2 - SQL

Simply open the rdbm.sql file in the script folder in for example heidi sql and run the sql code

## Step 3 - Inventory

### For QB-Inventory

Add the following at the bottom of qb-inventory/server/main.lua.

```lua
RegisterNetEvent("inventory:server:addtotrunk", function(plate, toSlot, fromSlot, item, amount, info)
	local itemInfo = QBCore.Shared.Items[item:lower()]
	if Trunks[plate] then else Trunks[plate] = {items = {},} end
	Trunks[plate].items[#Trunks[plate].items + 1] = {
	    name = itemInfo["name"],
	    amount = amount,
	    info = info ~= nil and info or "",
	    label = itemInfo["label"],
		description = itemInfo["description"] ~= nil and itemInfo["description"] or "",
	    weight = itemInfo["weight"],
        type = itemInfo["type"],
		unique = itemInfo["unique"],
	    useable = itemInfo["useable"],
        image = itemInfo["image"],
	    slot = #Trunks[plate].items + 1,
	}
end)
```

### Custom Script

If you don't use qb-inventory you have to create a server event similar to the one above that adds an item to a trunk. You may be able to use the same event depends on your inventory system.
