Mefisto_PL Posted December 1, 2012 Posted December 1, 2012 I don't understand how to use tocolor in this situation local bg = tocolor ( 0, 158, 255, 200 ) local wbg = tocolor ( 0, 0, 0, 200 ) function dupa ( ) dxDrawRectangle ( x/3.7, y/3.9, x/2.02, y/2.2, bg ) dxDrawRectangle ( x/3.6, y/3.5, x/2.08, y/2.4, wbg ) local blackpoint = dxDrawRectangle ( x/1.357, y/3.8, x/50, y/50, tocolor ( 0, 0, 0, 255 ) ) end function blackBG ( clickedElement ) if ( clickedElement == blackpoint ) then bg = tocolor ( 0, 0, 0, 250 ) wbg = tocolor ( 255, 255, 255, 250 ) end end addEventHandler ( "onClientClick", getRootElement(), blackBG )
TAPL Posted December 1, 2012 Posted December 1, 2012 (edited) blackpoint is local and it return bool also you have wrong parameter in function blackBG. Check wiki https://wiki.multitheftauto.com/wiki/OnClientClick Edited December 1, 2012 by Guest
Anderl Posted December 1, 2012 Posted December 1, 2012 DirectX rectangles aren't elements, neither dxDrawRectangle returns any kind of element. You gotta check cursor position on onClientClick.
Mefisto_PL Posted December 1, 2012 Author Posted December 1, 2012 TAPL, you mean I must do that: function blackBG ( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement ) if ( button == blackpoint ) then bg = tocolor ( 0, 0, 0, 250 ) wbg = tocolor ( 255, 255, 255, 250 ) end end addEventHandler ( "onClientClick", getRootElement(), blackBG ) right? It doesn't working.
Castillo Posted December 1, 2012 Posted December 1, 2012 DX aren't elements, you can't do it this way.
TAPL Posted December 1, 2012 Posted December 1, 2012 TAPL, you mean I must do that: function blackBG ( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement ) if ( button == blackpoint ) then bg = tocolor ( 0, 0, 0, 250 ) wbg = tocolor ( 255, 255, 255, 250 ) end end addEventHandler ( "onClientClick", getRootElement(), blackBG ) right? It doesn't working. Nope. button: This refers the button used to click on the mouse, can be left, right, or middle' What you looking for is clickedElement but since dxDrawRectangle aren't element, you can't use it until you find some other way like creating invisible window - label - or whatever in same position of the dxDrawRectangle, or you can check the clicked position with absoluteX and absoluteY.
Mefisto_PL Posted December 2, 2012 Author Posted December 2, 2012 So I can't do anything when I click on dx elements?
Anderl Posted December 2, 2012 Posted December 2, 2012 So I can't do anything when I click on dx elements? If you read everything people say, you'll know the answer.
Mefisto_PL Posted December 2, 2012 Author Posted December 2, 2012 But idk that I understand what they said.
Castillo Posted December 2, 2012 Posted December 2, 2012 You can either create a hidden GUI element in the same position or check the cursor position whenever you click.
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