MF Inventory

1) Go to mf-inventory/src/server/main.lua and add this code at bottom:

AddEventHandler('inventory:refresh', function()
	local resource = GetCurrentResourceName()
	local path = GetResourcePath(resource)
	MySQL.Async.fetchAll("SELECT * FROM av_items",{},function(items)
		for _,item in ipairs(items) do
			item.name = item.name:lower()
			item.unique = false
			item.weight = 1
			itemTemplates[item.name] = item
			if item.image then
				PerformHttpRequest(item.image, function (errorCode, resultData, resultHeaders)
					if errorCode >= 200 and errorCode < 300 then
						local image = assert(io.open(path..'/nui/items/'..item.name..'.png', "wb"))
						image:write(resultData)
						image:flush()
						image:close()
					end
				end)
			end
		end
	end)
end)

2) Inside main.lua go to line 707 and add this query above items query:

MySQL.Async.fetchAll("SELECT * FROM av_items",{},function(items)
      for _,item in ipairs(items) do
        item.name = item.name:lower()
        item.unique = false
        item.weight = 1
        itemTemplates[item.name] = item
      end
    end)

Last updated