VenomOG Posted April 15, 2020 Share Posted April 15, 2020 Ok hello ... i'll get straight to it. what if i had a table cars = { {411,"Infernus"}, {546,"Intruder"}, } but the table is longer .. how can i only select 5 a page? each page has the rest of the vehicle? Link to comment
Hoffmann Posted April 15, 2020 Share Posted April 15, 2020 (edited) I guess you want to display only 5 elements from table somewhere(on some page), right? The way you can do it is: local elements = {{411, "Infernus"}, {546, "Intruder"}, {429, "Banshee"}, {541, "Bullet"}, {531, "Tractor"}} local startIndex = 3 -- index to start with local numberOfElements = 2 local fiveElements = {} for idx = startIndex, startIndex + numberOfElements - 1 do outputChatBox(elements[idx][2]) -- for example, print names of vehicles in table from index 3 and select 2 elements that are next end The code above will output: Banshee Bullet Edited April 15, 2020 by Hoffmann Link to comment
VenomOG Posted April 15, 2020 Author Share Posted April 15, 2020 (edited) 6 hours ago, Hoffmann said: I guess you want to display only 5 elements from table somewhere(on some page), right? The way you can do it is: local elements = {{411, "Infernus"}, {546, "Intruder"}, {429, "Banshee"}, {541, "Bullet"}, {531, "Tractor"}} local startIndex = 3 -- index to start with local numberOfElements = 2 local fiveElements = {} for idx = startIndex, startIndex + numberOfElements - 1 do outputChatBox(elements[idx][2]) -- for example, print names of vehicles in table from index 3 and select 2 elements that are next end The code above will output: Banshee Bullet Either idk what is wrong or something but heres the code function dxDrawSpawner() dxDrawRelativeLine(565 - 1, 500 - 1, 565 - 1, 717, tocolor(1, 0, 0, 255), 1, false) dxDrawRelativeLine(816, 500 - 1, 565 - 1, 500 - 1, tocolor(1, 0, 0, 255), 1, false) dxDrawRelativeLine(565 - 1, 717, 816, 717, tocolor(1, 0, 0, 255), 1, false) dxDrawRelativeLine(816, 717, 816, 500 - 1, tocolor(1, 0, 0, 255), 1, false) dxDrawRelativeRectangle(565, 500, 251, 217, tocolor(0, 0, 0, 116), false) dxDrawRelativeLine(565, 529, 816, 529, tocolor(255, 255, 255, 255), 1, false) dxDrawRelativeText("VEHICLES", 564, 499, 816, 529, tocolor(255, 255, 255, 255), 1.00, dxfont0_vel, "center", "center", false, false, false, false, false) dxDrawRelativeRectangle(579, 533, 227, 29, tocolor(98, 98, 98, 111), false) dxDrawRelativeText(" Key: Vehicle Name:", 579, 533, 806, 562, tocolor(255, 255, 255, 255), 1.10, dxfont1_KOMIKAX, "left", "center", false, false, false, false, false) dxDrawRelativeText("Press 'M' to show cursor", 565, 718, 816, 753, tocolor(255, 0,0, 236), 1.00, dxfont2_KOMIKAX, "center", "center", false, false, false, false, false) for i, k in ipairs(vehs) do dxDrawRelativeRectangle(579, 541+i*21, 227, 21, isMouseInPosition(579, 541+i*21, 227, 21) and tocolor(0, 0, 0, 200) or tocolor(0, 0, 0, 75)) dxDrawRelativeText(i, 579, 541+i*21, 625, 562+(i)*21, tocolor(255, 255, 255, 255), 1, dxfont3_KOMIKAX, "center", "center", false, false, false, false, false) dxDrawRelativeText(getVehicleNameFromModel ( tonumber (k)), 635, 541+i*21, 806, 562+(i)*21, tocolor(255, 255, 255, 255), 1.10, dxfont3_KOMIKAX, "center", "center", false, false, false, false, false) end end Check the loop.. there is where it all starts.. trying to put 7 vehicles on each page only 7 Edited April 15, 2020 by VenomOG Link to comment
jakson Posted April 15, 2020 Share Posted April 15, 2020 Hello, I was will help you about the pages but when I opened my local sv and I tested this lines you put above I saw something like you are trying to copy saur spawners idea so sorry for that we cant help you to steal an idea from another server. Good luck. Link to comment
VenomOG Posted April 16, 2020 Author Share Posted April 16, 2020 14 hours ago, jakson said: Hello, I was will help you about the pages but when I opened my local sv and I tested this lines you put above I saw something like you are trying to copy saur spawners idea so sorry for that we cant help you to steal an idea from another server. Good luck. not my codes. i'm just a developer . i'm looking to change it anyways but i really need to know how to do pages for other stuff for some settings and designs . can you please? Link to comment
jakson Posted April 16, 2020 Share Posted April 16, 2020 5 hours ago, VenomOG said: not my codes. i'm just a developer . i'm looking to change it anyways but i really need to know how to do pages for other stuff for some settings and designs . can you please? Sorry brother, we cant help you about the spawners, that's really annoying if you took days to make a something and atlastest someone come to stole this idea for his server or a copycat server , put yourself in this situation if you made a server before years and you was working hard to make something good for players and someone come to stole all ideas of your scripts you will not be mad ? And sad for that ? If you want to copy another server you should learn by yourself none can help you to steal Years of fatigue of someone . 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