Olá, Estou Fazendo Um Sistema De Prisão, Estou Com Um Problema Nesse Sistema Que Quando Eu Seleciono Um Artigo Que Esta Na Posição 5 Por Exemplo e na parte de artigos selecionados ta vazio, ele não fica em primeiro e sim na posição 5, queria saber se tem algum jeito de resolver esse problema, imagem abaixo e codigo tambem:
Código Necessário:
- Mostrar Artigos Selecionados:
--/ Artigos Setados /--
dxCreateScrollBar("scroll:artigos:selecionados", 5, x * 1275, y * 473, x * 12, y * 296, 25, {using = {CONFIG.INTERFACE.USE_SCROLL_COLOR[1], CONFIG.INTERFACE.USE_SCROLL_COLOR[2], CONFIG.INTERFACE.USE_SCROLL_COLOR[3], 255}, scroll = {CONFIG.INTERFACE.SCROLL_COLOR[1], CONFIG.INTERFACE.SCROLL_COLOR[2], CONFIG.INTERFACE.SCROLL_COLOR[3], 255}, background = {CONFIG.INTERFACE.BG_SCROLL_COLOR[1], CONFIG.INTERFACE.BG_SCROLL_COLOR[2], CONFIG.INTERFACE.BG_SCROLL_COLOR[3], 255}}, (#CONFIG.ARTIGOS - options.visible_arts_selected) + 1, false)
local scrollDataSelectedArtigos = dxGetPropertiesScrollBar("scroll:artigos:selecionados")
if scrollDataSelectedArtigos and type(scrollDataSelectedArtigos) == "table" and next(scrollDataSelectedArtigos) then
local data = scrollDataSelectedArtigos.actual
local editboxID = tonumber(dxEditboxGetText("id-suspect"))
local targetPlayer = getPlayerID(editboxID)
for i = 0, options.visible_arts_selected - 1 do
local values_selected_artigo = CONFIG.ARTIGOS[i + data]
if values_selected_artigo and targetPlayer then
if getElementData(targetPlayer, values_selected_artigo["data_name"]) then
dxDrawText(values_selected_artigo["name"], x * 989 - 0, y * 485 + (i * 15), x * 117, y * 18, tocolor(255, 255, 255, 255), 0.6, fonts.bold, "left", "top")
dxDrawRoundedRectangle(x*975, y*783, x*296, y*38, 5, tocolor(51, 51, 51)) -- Button Confirmar
dxDrawText("Confirmar", x*1085, y*793, x*75, y*18, tocolor(255, 255, 255, 255), 0.5, fonts.bold, "left", "top")
if (isCursorOnElement(x*975, y*783, x*296, y*38)) then
dxDrawRoundedRectangle(x*975, y*783, x*296, y*38, 5, tocolor(31, 31, 31)) -- Button Confirmar
dxDrawText("Confirmar", x*1085, y*793, x*75, y*18, tocolor(255, 255, 255, 255), 0.5, fonts.bold, "left", "top")
end
dxDrawText(values_selected_artigo["name"], x * 989 - 0, y * 485 + (i * 15), x * 117, y * 18, tocolor(255, 255, 255, 255), 0.6, fonts.bold, "left", "top")
end
end
end
end
- Selecionar Artigo (OnClientClick) e o Mostrar Artigos Para Selecionar:
--/ Mostrar Artigos /--
dxCreateScrollBar ("scroll:select:artigos", 3, x*944, y*364, x*12, y*405, 25, {using = {CONFIG.INTERFACE.USE_SCROLL_COLOR[1], CONFIG.INTERFACE.USE_SCROLL_COLOR[2], CONFIG.INTERFACE.USE_SCROLL_COLOR[3], 255}, scroll = {CONFIG.INTERFACE.SCROLL_COLOR[1], CONFIG.INTERFACE.SCROLL_COLOR[2], CONFIG.INTERFACE.SCROLL_COLOR[3], 255}, background = {CONFIG.INTERFACE.BG_SCROLL_COLOR[1], CONFIG.INTERFACE.BG_SCROLL_COLOR[2], CONFIG.INTERFACE.BG_SCROLL_COLOR[3], 255}}, (#CONFIG.ARTIGOS - options.visible_arts) + 1, false)
local scrollDataSelectArtigos = dxGetPropertiesScrollBar ("scroll:select:artigos")
if scrollDataSelectArtigos and type (scrollDataSelectArtigos) == "table" and next (scrollDataSelectArtigos) then
local data = scrollDataSelectArtigos.actual
for i = 0, options.visible_arts - 1 do
local values_select_artigo = CONFIG.ARTIGOS[i + data]
if values_select_artigo then
dxDrawRoundedRectangle(x*653, y*378 - 0 + (i * 31), x*276, y*38, 5, tocolor(values_select_artigo.color_button1, values_select_artigo.color_button2, values_select_artigo.color_button3))
dxDrawText(values_select_artigo.art.." - "..values_select_artigo.name, x*689 - 15, y*388 + (i * 31), x*188, y*18, tocolor(255, 255, 255, 255), 0.5, fonts.bold, "left", "top")
--/ Hover /--
if (isCursorOnElement(x*653, y*378 - 0 + (i * 31), x*276, y*38)) then
dxDrawRoundedRectangle(x*653, y*378 - 0 + (i * 31), x*276, y*38, 5, tocolor(112, 143, 166))
dxDrawText(values_select_artigo.art.." - "..values_select_artigo.name, x*689 - 15, y*388 + (i * 31), x*188, y*18, tocolor(255, 255, 255, 255), 0.5, fonts.bold, "left", "top")
end
--/ Button Aplicar/Remover /--
--[[if (visible_aplicar == true) then
dxDrawRoundedRectangle(x*643, y*783, x*296, y*38, 5, tocolor(31, 31, 31))
dxDrawText("Aplicar/Remover", x*729, y*793, x*123, y*18, tocolor(255, 255, 255, 255), 0.5, fonts.bold, "left", "top")
end]]--
end
end
end
-- Selecionar Artigos --
addEventHandler("onClientClick", root, function(b, s, id)
if (b == "left" and s == "down") then
if (isEventHandlerAdded("onClientRender", root, renderPrison)) then
--/ Selecionar Artigo /--
editboxID = dxEditboxGetText("id-suspect")
local scrollDataSelectArtigos = dxGetPropertiesScrollBar ("scroll:select:artigos")
if scrollDataSelectArtigos and type (scrollDataSelectArtigos) == "table" and next (scrollDataSelectArtigos) then
local data = scrollDataSelectArtigos.actual
for i = 0, options.visible_arts - 1 do
local values_select_artigo = CONFIG.ARTIGOS[i + data]
if values_select_artigo then
--/ Selecionar o Artigo /--
if (isCursorOnElement(x*653, y*378 - 0 + (i * 31), x*276, y*38)) then
if (editboxID == "") then
notifyC("Insira o ID Do Suspeito", "error")
else
triggerServerEvent("LEO >> SetarArtigo", localPlayer, localPlayer, values_select_artigo["art"], values_select_artigo["name"], editboxID, values_select_artigo["data_name"])
end
end
end
end
end
end
end
end)
Imagem: