Jump to content

MTA Scripting - DX Help


Recommended Posts

  
local color = tocolor(255, 255, 255, 255) 
function onClientCursorMove( x, y, absX, absY ) 
      if isInBox( absX, absY ,482, 482 +  537, 330, 330+344 )  then 
              color =  tocolor(255, 0, 0, 255) 
      else 
              color =  tocolor(255, 255, 255, 255) 
      end 
end 
addEventHandler( "onClientCursorMove", getRootElement( ), onClientCursorMove ) 
  
addEventHandler("onClientRender", root, function() 
dxDrawText("RaysMTA", 482, 330, 537, 344, color, 1.00, font) 
end 
  
) 
  
function isInBox( x, y, xmin, xmax, ymin, ymax) 
    if x and y and xmin and xmax and ymax and ymin then 
        return x >= xmin and x <= xmax and y >= ymin and y <= ymax 
    end 
end 
  

Link to comment

try this

  
ocal color = tocolor(255, 255, 255, 255) 
function onClientCursorMove( x, y, absX, absY ) 
      if isInBox( absX, absY ,482, 482 +  124, 330, 330+124)  then 
              color =  tocolor(255, 0, 0, 255) 
      else 
              color =  tocolor(255, 255, 255, 255) 
      end 
end 
addEventHandler( "onClientCursorMove", getRootElement( ), onClientCursorMove ) 
  
addEventHandler("onClientRender", root, function() 
dxDrawText("RaysMTA", 482, 330, 537, 344, color, 1.00, font) 
end 
  
) 
  
function isInBox( x, y, xmin, xmax, ymin, ymax) 
    if x and y and xmin and xmax and ymax and ymin then 
        return x >= xmin and x <= xmax and y >= ymin and y <= ymax 
    end 
end 
  

Link to comment
local color = tocolor(255, 255, 255, 255) 
  
function theCursor() 
    if isCursorShowing() then 
        if isMouseInPosition( 482, 330, 537, 344 )  then 
            color =  tocolor(255, 0, 0, 255) 
        else 
            color =  tocolor(255, 255, 255, 255) 
        end 
    end 
end 
addEventHandler( "onClientCursorMove", getRootElement( ), theCursor ) 
  
addEventHandler("onClientRender", root, function() 
    dxDrawText("RaysMTA", 482, 330, 537, 344, color, 1.00, font) 
end 
) 
  
--[[ USEFUL BY Solidsnake14 (castillo) ]]-- 
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 

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