Jump to content

[HELP] Wrong calculation


Enargy,

Recommended Posts

Hi, I'm doing a new map (F11) but I have a small error when trying to add the size of an area, I tried with all the calculation but it doesn't work and sometimes I got bigger, smaller and some cases not appear.

addEventHandler("onClientRender", root, 
    function() 
        for k, v in ipairs(getElementsByType("radararea")) do 
                    local ax, ay = getElementPosition( v ) 
                    local asx, asy = getRadarAreaSize ( v )  
                    local r, g, b = getRadarAreaColor ( v )   
                     
                    local ax = math.round(x + (ax + 3000) * width / 6000) 
                    local ay = math.round(y - (ay - 3000) * height / 6000) 
             
                    -- heres the error, these calculations are badly: 
                    local sw = asx/6000*3000 
                    local sh = -(asy/6000*3000) 
  
                    local width1 = sw * asy / 3000 * sh / 2 
                    local height1 = sh * asy / 3000 * sh / 2 
                                        -- 
                    dxDrawRectangle(ax + 1, ay - 1, width1, height1, tocolor(r,g,b,100),false) 
  
        end      
    end 
) 

Any help or an example would help. Thanks

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