Jump to content

Learn script


franku

Recommended Posts

Posted

You can use 'for' loop to draw multiple rectangle based on their position and index from loop. http://www.lua.org/pil/4.3.4.html

Example:

for i=1, 12 do 
    dxDrawRectangle(500, 100+(i*50), 50, 30, tocolor(0, 0, 0, 255)) 
end 

Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS.

Developer and owner of

https://projectbea.st - Project Beast
Posted

DX functions return only boolean value. That means it's true (if created successfully) or false (otherwise).

That is a bit harder. You'll have to calculate their intersections. Like this (based on my example):

addEventHandler("onClientClick", root, 
    function(button, state, x, y) 
        if button == "left" and state == "down" then 
            for i=1, 12 do 
                if x >= 500 and x <= 500+50 and y >= 100+(i*50) and y <= 100+(i*50)+30 then 
                    outputChatBox("Pressed on rectangle number "..i) 
                end 
            end 
        end 
    end 
) 

Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS.

Developer and owner of

https://projectbea.st - Project Beast
Posted

ipairs/pairs is used when you're looping through a table. We are using so-called numeric for which loops through specific chunk and returns current processed number based on what numbers you expressed as values in for loop.

Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS.

Developer and owner of

https://projectbea.st - Project Beast

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...