#Jim-mechanic working with tgiann-inventory (QBCORE)

1 messages · Page 1 of 1 (latest)

languid onyx
#

I have converted a lot for jim-mechanic to work with tgiann-inventory. there are a few steps you need to take. The crafting bench, and items for repair and upgrades are working along with mechanic stashes. The mechanic shop I have setup through tgiann-inventory and I do not use jim-mechanic config for the shop. MAKE A BACKUP FIRST BEFORE ANY CHANGES.

STEP 1. Go to your Jim-bridge. Go to the crafting.lua file and copy and paste my code.

STEP 2. Got into jim-bridge and change QBinv to this

QBInv = "tgiann-inventory", This is just for simplicty, change how you like.

STEP 3. Go into jim-mechanic/functionserver.lua

(this may or may not work for you but no harm in trying. The main things needed is jim-bridge)
and copy and paste my code.
All codes will be linked below.

Disclaimer

I do not give support for jim-mechanic, nor tgiann-scripts, I just give a helping hand when im able to, but im not always correct.

#

@solemn canopy

mossy badger
#

anyone tested this?

solemn canopy
#

This no longer works

#

It will attempt the progress bar, and finish the progress bar but no item recieved.

solemn canopy
#

It doesnt seem to be able to pull the items from the stash. Not sure if its just for me

languid onyx
solemn canopy
#

I had to modifu it a bit to work again

#

one sec ill share my change

#
        local updatedStashItems = {}
        for _, stashItem in pairs(stashItems) do
            if items[stashItem.name] then
                local remainingAmount = stashItem.amount - items[stashItem.name]
                if remainingAmount > 0 then
                    stashItem.amount = remainingAmount
                    table.insert(updatedStashItems, stashItem)
                    if Config.System.Debug then
                        print("^6Bridge^7: ^2Removing partial amount of item from ^3Stash^2 with ^7" .. QBInv, stashItem.name, items[stashItem.name])
                    end
                else
                    if Config.System.Debug then
                        print("^6Bridge^7: ^2Removing item from ^3Stash^2 with ^7" .. QBInv, stashItem.name, items[stashItem.name])
                    end
                end
            else
                table.insert(updatedStashItems, stashItem)
            end
        end
        
        for k, v in pairs(items) do
            local itemData = exports["tgiann-inventory"]:GetItemByNameFromSecondInventory("stash", stashName, k)
            if itemData and itemData.amount >= v then
                local success = exports["tgiann-inventory"]:RemoveItemFromSecondInventory("stash", stashName, k, v, itemData.slot)
                if success then
                    print("^6Bridge^7: ^2Successfully removed ^7" .. v .. " ^2of ^7" .. k)
                else
                    print("^4ERROR^7: ^2Failed to remove item ^7" .. k)
                end
            end
        end
    
        if Config.System.Debug then
            print("^6Bridge^7: ^3saveStash^7: ^2Saving ^3QB^2 stash ^7'^6"..stashName.."^7'")
        end
        MySQL.Async.insert('INSERT INTO tgiann_inventory_stashitems (stash, items) VALUES (:stash, :items) ON DUPLICATE KEY UPDATE items = :items', { ['stash'] = stashName, ['items'] = json.encode(updatedStashItems) })
    else
        print("^4ERROR^7: ^2No Inventory detected ^7- ^2Check ^3exports^1.^2lua^7")
    end
end```
#

jim_bridge crafting.lua from 475 to the end there at 515

mossy badger
languid onyx