Jump to content

Movable Images


Dice

Recommended Posts

Posted

Hello again, I am currently using an image as a template and I am curious how to make a image movable, pretty much treat it like if it were a window.

Posted
  
addEventHandler ( "onClientGUIMouseDown", root, dragDown ) -- < that is embedded within onClientResourceStart because that is where GUI variables are 
function dragDown ( button, x, y ) 
    if button == "left" then 
        if source == main then 
            outputChatBox ( "124" ) 
            wX, wY = guiGetPosition ( maun, false ) 
            z = x - wX 
            s = y - wY 
            addEventHandler ( "onClientCursorMove", root, 
                function(_,_,a,b) 
                    if ftamainp then 
                        guiSetPosition ( main, a - z, b - s, false ) 
                    end 
                end 
            ) 
        end 
    end 
end 

It works, but I can't figure out how to remove the onClientCursorMove when onClientGUIMouseUp

  • Moderators
Posted

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted

@ IIYAMA You can't do that when the function is embedded....but thanks you gave me another idea.

Snake I didn't even know that function existed so thanks lol.

figured it out.

Posted

Is an event, not a function.

You're welcome.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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