rusztamas Posted July 6, 2017 Share Posted July 6, 2017 Hi! I'd like to make a dxDraw scoreboard, but i have no idea how to get started with it. Any ideas? I'd really appreciate your help this time. Link to comment
szekelymilan Posted July 7, 2017 Share Posted July 7, 2017 A rectangle, then use dxDrawText, and a for loop for ipairs(getElementsByType('player')). Link to comment
pa3ck Posted July 7, 2017 Share Posted July 7, 2017 Well the question is, which part you don't know? The scrolling part? Drawing part? Maybe sorting? There's a function I wrote in one of the websites I developed that had pagination, I think the basic idea can be applied to the scoreboard as well. This code might help you with the scrolling: local players = {} -- dummy player table local itemOnPage = 10 -- maximum 10 players / page local currPage = 3 -- get the players on page 3 for i = 1, 35 do -- create 35 dummy players table.insert(players, 'plr ID: ' .. i) end function getMaxPage() print( "Maximum pages (starts from 0): " .. math.ceil(#players / itemOnPage)) end function currPageItems() -- reads in currPage var. and returns the players that belong to that particular page local returnedPlayers = {} -- loop from the start of the page, ie if currPage * itemOnPage = 3 * 10 = 30 is our starting point -- loop until currPage + 1 * itemOnPage = (3 + 1) * 10 = 40 for i = currPage * itemOnPage, (currPage + 1) * itemOnPage do if players[i] then -- the last page might not have full list table.insert(returnedPlayers, i) -- this table will be returned, which you can use in your onClientRender else break end end return returnedPlayers end getMaxPage() for k, v in ipairs(currPageItems()) do print(players[v]) -- get a list of players depending on the variable: currPage and print their 'names' end All you have to do is manually (using binds, ie. mouse scroll) change the variable currPage + 1 or currPage - 1. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now