Quando clico no item não seleciona. Este é meu código atual...
local screenW, screenH = guiGetScreenSize()
local show_inv = false
local show_confirm = false
local selectedC = tocolor(0, 255, 255, 255)
local colorC = tocolor(0, 0, 0, 0)
local selected = nil
function dxInv()
local dados = getElementData(localPlayer, 'inv.item') or {}
local peso = pesoI(localPlayer)
slots = {}
local x = 0.4047
local tx = 0.4344
local ty = 0.3971
local y = 0.3919
for i,v in ipairs(dados) do
dxDrawImage(screenW * x, screenH * y, screenW * 0.0484, screenH * 0.0755, item[(v.id)].img, 0, 0, 0, tocolor(255, 255, 255, 255), true)
dxDrawText("("..(v.qnt)..")", screenW * tx, screenH * ty, screenW * 0.4516, screenH * 0.4141, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, true, false, false)
dxDrawRectangle(screenW * x, screenH * y, screenW * 0.0484, screenH * 0.0755, i == selected and selectedC or colorC, false)
slots[i] = {screenW * x, screenH * y, screenW * 0.0484, screenH * 0.0755}
x = x + 0.0530
tx = tx + 0.0515
if x > 0.6009 then
y = y + 0.0808
x = 0.4047
tx = 0.4273
ty = ty + 0.0808
end
end
end
function clickInv(b, s)
if show_Inv == true then
if s=='down' then
if b=='left' then
for i,v in ipairs(slots) do
if isMouseInPosition(v[1], v[2], v[3], v[4]) then
selected = i
end
end
end
end
end
end
function isMouseInPosition ( x, y, width, height )
if ( not isCursorShowing( ) ) then
return false
end
local sx, sy = guiGetScreenSize ( )
local cx, cy = getCursorPosition ( )
local cx, cy = ( cx * sx ), ( cy * sy )
return ( ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) )
end