Jump to content

[HELP]Framework - isMouseInPosition


*Shad0w

Recommended Posts

Hi guys

Someone help me with the error pleasee?

framework.lua

  
776         function isMouseInPosition(x,y,width,height) 
777            local cx, cy = getCursorPosition() 
778            local cx, cy = (cx*SX), (cy*SY) 
779            if (cx >= x and cx <= x + width) and (cy >= y and cy <= y + height) then 
780                     return true 
781            else 
782                        return false 
783                end 
784         end 
  

YGJr2mD.png

Link to comment

Here's a function from wiki:

function isMouseInPosition ( x, y, width, height ) 
    if ( not isCursorShowing ( ) ) then 
        return false 
    end 
  
    local sx, sy = guiGetScreenSize ( ) 
    local cx, cy = getCursorPosition ( ) 
    local cx, cy = ( cx * sx ), ( cy * sy ) 
    if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then 
        return true 
    else 
        return false 
    end 
end 

You are trying to compare a number with nil, but because cx and cy should be fine and I can't see SX and SY defined anywhere, I think that's your problem. In the code from wiki, sx and sy are from the guiGetScreenSize(), make sure you have this line somewhere in your code:

local SX, SY = guiGetScreenSize ( ) 

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