Wert-shops + delivery jobs (Buy and manage your shops)

You can access the setup information you need about this product

INFORMATION

  • Buy and manage grocery stores. Add new items to your grocery store by ordering goods from the trade center

  • Don't forget to put the pictures of the items you will add to the images folder (NOT THE PICTURES WILL NOT APPEAR).

INSTALLATION

1 - Prepare the depends scripts and upload them to the resources folder

2 - Follow the instructions in the important section for qb framework.

IMPORTANT (ONLY QB FRAMEWORK)

This install step with old qb-inventory if u use old version follow this step but if u have last updated qb-inventory please check below follow step!

This is a very important step that allows purchases to connect with wert shops!

  • Open qb-inventory/server/main.lua

    • Add the following codes to the place shown in the picture

    • Event name : 'inventory:server:SetInventoryData'

  • And add this lines

```lua
local shopfound = exports['wert-shops']:ShopCheck(QBCore.Shared.SplitStr(shopType, "_")[2])
if shopfound then
    TriggerEvent("wert-shops:server:UpdateShopItems", QBCore.Shared.SplitStr(shopType, "_")[2], itemData, fromAmount)
    TriggerEvent("wert-shops:server:after-buy", QBCore.Shared.SplitStr(shopType, "_")[2], price)
end
```

IMPORTANT (ONLY NEW UPDATE QB INVENTORY)

This is a very important step that allows purchases to connect with wert shops!

  • Open qb-inventory/server/main.lua

  • Find this callback and change with this

QBCore.Functions.CreateCallback('qb-inventory:server:attemptPurchase', function(source, cb, data)
    local itemInfo = data.item
    local amount = data.amount
    local shop = string.gsub(data.shop, 'shop%-', '')
    local price = itemInfo.price * amount
    local Player = QBCore.Functions.GetPlayer(source)

    if not Player then
        cb(false)
        return
    end

    local shopInfo = RegisteredShops[shop]
    if not shopInfo then
        cb(false)
        return
    end

    local playerPed = GetPlayerPed(source)
    local playerCoords = GetEntityCoords(playerPed)
    if shopInfo.coords then
        local shopCoords = vector3(shopInfo.coords.x, shopInfo.coords.y, shopInfo.coords.z)
        if #(playerCoords - shopCoords) > 10 then
            cb(false)
            return
        end
    end

    if not CanAddItem(source, itemInfo.name, amount) then
        TriggerClientEvent('QBCore:Notify', source, 'Cannot hold item', 'error')
        cb(false)
        return
    end

    if Player.PlayerData.money.cash >= price then
        Player.Functions.RemoveMoney('cash', price, 'shop-purchase')
        AddItem(source, itemInfo.name, amount, nil, itemInfo.info, 'shop-purchase')
        local shop_first = QBCore.Shared.SplitStr(shop, "_")[1]
        if shop_first and shop_first == 'WertShop' then
            local shop_preset = QBCore.Shared.SplitStr(shop, "_")[2]
            local shopfound = exports['wert-shops']:ShopCheck(shop_preset)
            if shopfound then
                TriggerEvent("wert-shops:server:UpdateShopItems", shop_preset, itemInfo, amount)
                TriggerEvent("wert-shops:server:after-buy", shop_preset, price)
            end
        else
            TriggerEvent('qb-shops:server:UpdateShopItems', shop, itemInfo, amount)
        end
        cb(true)
    else
        TriggerClientEvent('QBCore:Notify', source, 'You do not have enough money', 'error')
        cb(false)
    end
end)

OX LIB OPTION

1 - Open Config.lua and find this option

2 - Open fxmanifest.lua and activate or open this code line (Import Code)

3 - Already, okey

Installation complete

Last updated