Jump to content

Question about Dx


Oussema

Recommended Posts

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 by Forthwind
Link to comment
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

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 by Mr.Loki
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...