papam77 Posted December 31, 2013 Share Posted December 31, 2013 Hello, can you tell me with this does not work? When I click to button nothing happend it has to say ,,true" local sX, sY = guiGetScreenSize() function test2 () dxDrawRectangle(sX/4, sY/4, sX/8, sY/8, tocolor(0,255,0,255), false) showCursor(true) end addEventHandler("onClientRender", root, test2 ) function test ( button, state, x, x ) if (button == 'left' or button == 'right' or state == 'down') then local checkX = ( x > sX/4 and x < sX/8 ) local checkY = ( y > sY/4 and y < sY/8 ) if ( checkX and checkY ) then outputChatBox("true") end end end addEventHandler("onClientClick", getResourceRootElement(getThisResource()), test) Link to comment
csiguusz Posted December 31, 2013 Share Posted December 31, 2013 You had a few mistakes. Try this: local sX, sY = guiGetScreenSize() function test2 () dxDrawRectangle(sX/4, sY/4, sX/8, sY/8, tocolor(0,255,0,255), false) showCursor(true) end addEventHandler("onClientRender", root, test2 ) function test ( button, state, x, y ) if (button == 'left' or button == 'right' or state == 'down') then local checkX = ( x > sX/4 and x < 2*sX/4-sX/8 ) local checkY = ( y > sY/4 and y < 2*sY/4-sY/8 ) if ( checkX and checkY ) then outputChatBox("true") end end end addEventHandler("onClientClick", root, test) Link to comment
papam77 Posted December 31, 2013 Author Share Posted December 31, 2013 It works thank you! Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now