Jump to content

onClientClick help.


Xeno

Recommended Posts

I'm working with dxDraw now, and I'm trying to make it so you can press a piece of text so it triggers something else.

I neally got it to work, but I need it so it works when I click on the dxDrawText, because at the moment, the GUI appears when I click anywhere on the screen. Please help me.

dxDrawText ( "Chheseseseses", 050, screenHeight - 530, screenWidth, screenHeight, tocolor ( 0,0,0, 255 ), 5,  "sans" ) 

function news(clickedElement) 
if (clickedElement) then 
addEventHandler("onClientRender",rootElement, serverBoxDesign)  
end 
end 
addEventHandler ( "onClientClick", getRootElement(), news ) 

Link to comment

You are triggering the event onClientClick, if you don't insert an if statement for check what you've clicked it will show the text always, do like this:

function news(clickedElement) 
if (clickedElement == something) then 
addEventHandler("onClientRender",rootElement, serverBoxDesign) 
end 
end 
addEventHandler ( "onClientClick", getRootElement(), news ) 

You want that when you click on something like a text it shows another text? You must repleace "something" in the if whit the text name, and (i think) it will work :D

Link to comment
  Solidsnake14 said:
The first argument of "onClientClick" is the mouse button pressed, not the world element clicked.
function news(clickedElement) 
if (clickedElement == login) then 
addEventHandler("onClientRender",rootElement, serverBoxDesign) 
end 
end 
addEventHandler ( "onClientClick", down, news ) 

Error: Bad arguement @ "addEventHandler" [Expected Element at arguement, 2 got nil]

Link to comment

You want to detect when click on a GUI element? if so use "onClientGUIClick".

function news(_,_,_,_,_,_,_,clickedElement) 
if (clickedElement == login) then 
addEventHandler("onClientRender",rootElement, serverBoxDesign) 
end 
end 
addEventHandler ( "onClientClick", root, news ) 

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