Oussema Posted March 21, 2019 Share Posted March 21, 2019 Hello ! as you can see in the photo , drawing rectangles in 4 lines and max of rectangle by line are 6 i just want know how to draw the rectangles like that for example like in the image 4 lines & max by line 6 sorry for bad explaining Link to comment
Forthwind Posted March 21, 2019 Share Posted March 21, 2019 (edited) Those are individual rectangles put next to eachother. Download guieditor, make a rectangle, copy it, paste it, put it next/under the previous one. Done. Edit: Can also make the script add them using simple math. Edited March 21, 2019 by Forthwind Link to comment
Oussema Posted March 21, 2019 Author Share Posted March 21, 2019 1 hour ago, Forthwind said: Those are individual rectangles put next to eachother. Download guieditor, make a rectangle, copy it, paste it, put it next/under the previous one. Done. Edit: Can also make the script add them using simple math. i won't by guieditor .... i want add them by using math but idk how This test code will draw 12 rectangle one next one !! i want it draw the rectangle in 4 lines and every line has 3 rectangle , so 3x4=12 !! any one can help me ? local test = { {"aaaaa",100}, {"xxx",100}, {"qqq",100}, {"dsqd",100}, {"dsqdqsd",100}, {"dsqdqsd",100}, {"dsqdqsd",100}, {"dsqdqsd",100}, {"dqsdsqd",100}, {"dsqdqsdsqd",100}, {"dsqdqsdqs",100}, {"dsqdqsdq",100}, --12 } addEventHandler("onClientRender", root, for i, v in ipairs (items) do dxDrawRectangle ( 500+i*50,400,50,50 tocolor ( 0, 0, 0, 150 ) ) end end) Link to comment
Mr.Loki Posted March 21, 2019 Share Posted March 21, 2019 (edited) You can use a loop inside another loop. 1 loop for rows and the other for columns. local cols,rows = 4,6 local size = 45 local space = size + 5 addEventHandler( "onClientRender", root, function( ) for row=0,rows-1 do for col=0,cols-1 do dxDrawRectangle( 10+(space*row), 300+(space*col), size, size ) end end end ) Or instead of calculating the positions in real-time you can store it in a table then draw them. Edited March 21, 2019 by Mr.Loki 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