Xwaw Posted February 21, 2023 Share Posted February 21, 2023 Welcome back In general, I'm currently making a scoreboard under Tab with a list of players, so I have a few questions... 1. How to make a list that shows elements that are outside the image under the scroll, e.g. when scrolling html or guiCreateGridList function but with more elements than its scale offers (Using dxDraw family functions) 2. Or is there a possibility to blur something like placing a gradient so that some dxDraw elements line up in a shape other than a square or rectangle. If you still don't know what I mean, here's an example of what I want to do: I have a plan how the list of players (scoreboard TAB) will look like after pressing the [TAB] key and in general, if there are too many of these players, it is known that 1920x1080x monitor screen will not accommodate, for example, 400 players in the index so that it is visible, so you will need to add some scrolling system and here is my problem because I've never done anything like that and I don't know if it's possible to create a dxDraw function that simulates a guiGridList or add a gradient that will freeze most of the list so that it is visible for the computer screen, but not for us. Please give me an example with a detailed explanation Link to comment
alex17" Posted February 21, 2023 Share Posted February 21, 2023 local players = {} local maxItems = 10 local scroll = 0 local open = false bindKey("tab", "down", function manageScoreboard() if not open then open = true players = nil players = {} for _, player in ipairs(getElementsByType("player") do table.insert(players, player) end bindKey("mouse_wheel_up", "down", mouseWheel) bindKey("mouse_wheel_down", "down", mouseWheel) addEventHandler("onClientRender", root, dxDrawScoreboard) else open = false unbindKey("mouse_wheel_up", "down", mouseWheel) unbindKey("mouse_wheel_down", "down", mouseWheel) removeEventHandler("onClientRender", root, dxDrawScoreboard) end end ) function mouseWheel(key) if key == "mouse_wheel_down" then if scroll < (players - maxItems) then scroll = scroll + 1 end else if scroll > 0 then scroll = scroll - 1 end end end function dxDrawScoreboard() local cache = 0 for i = 1 + scroll, maxItems + scroll do local player then yers[i] if player then dxDrawRectangle(0, cache, 400, 100, "0x96000000") dxDrawText(getPlayerName(player), 0, cache, 400, 100 + cache) cache = cache + 100 end end end I leave you a very basic example so you can guide yourself 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