Skip to content

Sell Shops

Sell Shops is a server-side system built into the bridge that lets players sell items for cash through a stash-style inventory UI. You register a shop with accepted items and prices, then open it for a player; the system handles the rest.

How it works

  1. You register a sell shop with a unique ID, label, and a table of items and prices.
  2. When a player opens the shop, they see a stash inventory.
  3. When they move an item from their inventory into the shop stash, the item is consumed and they receive cash (price × quantity).
  4. The shop stash is cleared after each transaction.

Under the hood

Sell shops use the inventory stash system. A hook intercepts the item move and handles payment and cleanup automatically.

Server exports

RegisterSellShop

Registers a new sell shop. Call this before opening the shop for any player.

lua
exports["prp-bridge"]:RegisterSellShop(id, payload)
ParameterTypeDescription
idstringUnique shop identifier.
payloadtableConfig (see below).

Payload

FieldTypeRequiredDescription
labelstringYesName shown in the stash UI.
itemstableYesSellable items (see Items).
reasonstringNoReason used for logging.
coordsvector3NoShop location.

Items

Keyed by item name. Each entry has label and price.

lua
items = {
    ["gold_bar"] = { label = "Gold Bar", price = 500 },
    ["silver_bar"] = { label = "Silver Bar", price = 200 },
}
FieldTypeDescription
labelstringDisplay name (e.g. in notifications).
pricenumberCash per unit sold.

Unlisted items

Items not in the items table cannot be sold. Moving an unlisted item into the stash shows an error and leaves the item in the player’s inventory.

OpenSellShop

Opens a registered sell shop for a player.

lua
exports["prp-bridge"]:OpenSellShop(source, id)
ParameterTypeDescription
sourcenumberPlayer server ID.
idstringShop ID used in RegisterSellShop.

Re-registering

If the shop is already registered, calling RegisterSellShop again with the same ID does nothing. You can safely call it in the same handler as OpenSellShop.

Examples

Basic sell shop

lua
exports["prp-bridge"]:RegisterSellShop("my_shop", {
    label = "Pawn Shop",
    items = {
        ["gold_ring"] = { label = "Gold Ring", price = 150 },
        ["silver_chain"] = { label = "Silver Chain", price = 75 },
        ["diamond"] = { label = "Diamond", price = 1000 },
    }
})

RegisterNetEvent("myresource:openShop", function()
    local src = source
    exports["prp-bridge"]:OpenSellShop(src, "my_shop")
end)

Dynamic items from config

Build the items table from your resource config at startup (common pattern in Prodigy resources).

lua
local sellingItems = {}
for itemName, itemData in pairs(Config.Items) do
    if itemData.sellPrice then
        sellingItems[itemName] = {
            label = itemData.label,
            price = itemData.sellPrice,
        }
    end
end

exports["prp-bridge"]:RegisterSellShop("mining", {
    label = "Sell Materials",
    items = sellingItems
})

RegisterNetEvent("mining:openSellShop", function()
    exports["prp-bridge"]:OpenSellShop(source, "mining")
end)

With ped interaction

Pair a sell shop with a ped interaction so players sell at an NPC.

lua
-- Client
exports["prp-bridge"]:AddPedInteraction("shop_npc", {
    model = "s_m_m_strvend_01",
    coords = vector3(100.0, 200.0, 30.0),
    heading = 180.0,
    radius = 40.0,
    scenario = "WORLD_HUMAN_STAND_IMPATIENT",
    options = {
        {
            icon = "fas fa-cart-shopping",
            label = "Sell Items",
            distance = 2.0,
            onSelect = function()
                TriggerServerEvent("myresource:openShop")
            end
        }
    }
})

-- Server
exports["prp-bridge"]:RegisterSellShop("my_shop", {
    label = "Sell Items",
    items = {
        ["fish_bass"] = { label = "Bass", price = 25 },
        ["fish_salmon"] = { label = "Salmon", price = 40 },
    }
})

RegisterNetEvent("myresource:openShop", function()
    exports["prp-bridge"]:OpenSellShop(source, "my_shop")
end)