Jump to content

Lojinha


Recommended Posts

Estou com uma lojinha com inventario acoplado e estou modificando ele totalmente, e queria fazer um metodo de ao arrastar o item da lojinha para o Dx expecifico ele iria compraria o item e iria para o inventario, e que tambem daria para digitar a quantidade e arrastar o item para o dx e viria essa quantidade especifica

if shop == "food" then
		dxDrawText("Loja de Alimentos", x*980, y*120, x*130, y*38, tocolor(255, 255, 255, 255), 0.80, hype.Fonte01, "left", "top", false, false, false, true, false)


		if tonumber(editQuantidade) then
			dxDrawText("Total: $"..FoodShopItems[selecionado][2]*editQuantidade, x*780, y*256, x*130, y*38, tocolor(255, 255, 255, 255), 0.60, hype.Fonte01, "left", "center", false, false, false, true, false)
		end

		for i, v in pairs(SlotItens["Slots"]) do
			for index, value in pairs(FoodShopItems) do
				if i == index then
					dxDrawImage(SlotItens["Slots"][i][1], SlotItens["Slots"][i][2], SlotItens["Slots"][i][3], SlotItens["Slots"][i][4], "gfx/itens/"..FoodShopItems[index][1]..".png", 0, 0, 0, tocolor(255, 255, 255, 255))
				end
			end
		end

		if isCursorShowing() and not isTradeVisible and not isReceivingTrade then
			for i, v in pairs(SlotItens["Slots"]) do
				if isCursorOnElement(SlotItens["Slots"][i][1], SlotItens["Slots"][i][2], SlotItens["Slots"][i][3], SlotItens["Slots"][i][4]) then
					for index, value in pairs(pesoItens) do
						if FoodShopItems[i] ~= nil then
							if FoodShopItems[i][1] == index then
								if not itemMoving then
									local y = SlotItens["Slots"][i][2] + SlotItens["Slots"][i][4] + (screenH/200)
									local size = 0
									local cX, cY = getCursorPosition()
									local cachePeso = string.format("%.1f", tostring(pesoItens[index][1]))
									if dxGetTextWidth(realName[FoodShopItems[i][1]][1], 0.50, hype.Fonte01) > dxGetTextWidth("Quantidade: "..FoodShopItems[i][2], 0.50, hype.Fonte01) then
										size = dxGetTextWidth(realName[FoodShopItems[i][1]][1], 0.50, hype.Fonte01) + (screenW/55)
									else
										size = dxGetTextWidth("Quantidade: "..FoodShopItems[i][2], 0.50, hype.Fonte01) + (screenW/55)
									end
									dxDrawRoundedRectangle(screenW*cX-(size/2), y, size, screenH * 0.0800, tocolor(28, 28, 28, 255), 5)
									dxDrawText(realName[FoodShopItems[i][1]][1].."\nPeso: "..cachePeso.."kg\nValor: $"..FoodShopItems[i][2], screenW*cX-(size/2), y, screenW*cX-(size/2)+size, y+screenH * 0.0800, tocolor(255, 255, 255, 255), 0.50, hype.Fonte01, "center", "center", false, false, false, false, false)
								end
							end
						end
					end
				end
			end
		end

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...