Jump to content

HElp CURSOR


Recommended Posts

Hi Guys,

It's Dx Button

How I can check here if left mouse button is UP ?

function dxDrawButton(x,y,w,h,name,nameSize,borderColor,cx,cy) 
        if (not cx) or (not cy) then 
        cx,cy = getCursorPosition() 
        end 
        nameSize = nameSize or 1.00 
        borderColor = borderColor or tocolor(0,0,0,255) 
        if isMouseWithinRangeOf(x,y,w,h,cx,cy) then 
            if getKeyState("mouse1") then 
                borderColor = tocolor(0, 100, 100, 200) 
            else 
                borderColor = tocolor(0, 200, 200, 200) 
            end 
        end 
        dxDrawLine(x - 1, y - 1, x - 1, y + h, borderColor, 1, false) 
        dxDrawLine(x + w, y - 1, x - 1, y - 1, borderColor, 1, false) 
        dxDrawLine(x - 1, y + h, x + w, y + h, borderColor, 1, false) 
        dxDrawLine(x + w, y + h, x + w, y - 1, borderColor, 1, false) 
        dxDrawRectangle(x, y, w, h, tocolor(0, 0, 0, 150), false) 
        dxDrawText(name, x , y , x + w, y + h, tocolor(255, 255, 255, 255), nameSize, "default", "center", "center", false, false, false, false, false) 
end 

Link to comment

This should give you the idea.

addEventHandler("onClientRender", root, 
function() 
    if getKeyState("mouse1") then 
        if not isDown then 
            isDown = true 
            outputChatBox("Down") 
        end 
    else 
        if isDown then 
            isDown = false 
            outputChatBox("Up") 
        end 
    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...