Hi.
So currently, im working on a scoreboard. I have some problems with the player scrolling. What i want to do is, when the player scrolls, the scoreboard should move too, so for example, player1 in the first bar becomes player2, the player2 in the second back becomes player3, and so on.
The code i currently have:
local x,y = guiGetScreenSize()
local renderData = {}
renderData.centerX = x / 2 - 317.5
renderData.centerY = y / 2 - 229.5
renderData.bgWidth = 635
renderData.bgHeight = 459
renderData.playersPerPage = 10
renderData.players = {}
renderData.currentRow = 1
renderData.counter = 1
--testtable filling
for i=1, 50, 1 do
renderData.players[i] = "player"..i
end
addEventHandler("onClientRender", getRootElement(),
function()
--background
dxDrawImage(renderData.centerX, renderData.centerY, renderData.bgWidth, renderData.bgHeight, "bg.png")
--problem with this.
for i=1, renderData.playersPerPage do
dxDrawText(renderData.players[szamlalo], x/2-300, 200 - y * 0.03 + (y * 0.05 * i)+15, x, y, tocolor(255, 255, 255, 255))
end
--drawing out the bars for the information
for k=1, 10 do
dxDrawImage(x/2-300, 200 - y * 0.003 + (y * 0.05 * k)-15, 599, 31, "bar.png")
end
end
)
bindKey("mouse_wheel_up", "down",
function()
if renderData.currentRow > 1 then
--renderData.currentRow = renderData.currentRow - 1
renderData.counter = renderData.counter - 1
end
end
)
bindKey("mouse_wheel_down", "down",
function()
if renderData.currentRow < 10 then
-- renderData.currentRow = renderData.currentRow + 1
renderData.counter = renderData.counter + 1
end
end
)
Thanks.