qbcore-framework / qb-inventory

Slot Based Inventory System Used With QB-Core :school_satchel:
GNU General Public License v3.0
51 stars 370 forks source link

[BUG] Transfer vending machine to qb-shop not in qb-inv #477

Closed bicatcho11 closed 6 months ago

bicatcho11 commented 7 months ago

Summary

It is better to transfer the code to a script qb-shop

Reproduction

The script should be somewhat independent

Actually, it is the correct place in the qb-shop script Not in qb-inv

Expected behavior

There will be more customization and the code will not be so large as to be distracting

---Gets the closest vending machine object to the client ---@return integer closestVendingMachine local function GetClosestVending() local ped = PlayerPedId() local pos = GetEntityCoords(ped) local object = nil for _, machine in pairs(Config.VendingObjects) do local ClosestObject = GetClosestObjectOfType(pos.x, pos.y, pos.z, 0.75, joaat(machine), false, false, false) if ClosestObject ~= 0 then if object == nil then object = ClosestObject end end end return object end

---Opens the vending machine shop local function OpenVending() local ShopItems = {} ShopItems.label = 'Vending Machine' ShopItems.items = Config.VendingItem ShopItems.slots = #Config.VendingItem TriggerServerEvent('inventory:server:OpenInventory', 'shop', 'Vendingshop_' .. math.random(1, 99), ShopItems) end

Actual behavior

More independence

Additional context

No response

Last Updated

today

Custom Resources

qb-target

Resource Rename

no