KaMeR Posted January 14, 2008 Share Posted January 14, 2008 button = guiCreateButton( 0.1, 0.2, 0.15, 0.06, "B TEST", true, WindowForm ) addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()), function ( ) if (source == button) then outputChatBox ( "Button Pressed" ) end end ) i tryed too> button = guiCreateButton( 0.1, 0.2, 0.15, 0.06, "B TEST", true, WindowForm ) function test () outputChatBox ( "Button Pressed" ) end addEventHandler ( "onClientGUIClick", button, test ) ) and wont work what is the problem?? (this and this doesnt work) Link to comment
Jumba' Posted January 14, 2008 Share Posted January 14, 2008 But what's the problem? you have to explain more, the button doesn't appear, or it doesnt show the text in the textbox, what? =/ btw, what's the ) at the end supposed to mean? Link to comment
KaMeR Posted January 14, 2008 Author Share Posted January 14, 2008 didnt see what is in function? nothing happend when click button =/ ! Link to comment
Cloudhunter Posted January 15, 2008 Share Posted January 15, 2008 button = guiCreateButton( 0.1, 0.2, 0.15, 0.06, "B TEST", true, WindowForm ) addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()), function ( ) if (source == button) then outputChatBox ( "Button Pressed" ) end end ) i tryed too> button = guiCreateButton( 0.1, 0.2, 0.15, 0.06, "B TEST", true, WindowForm ) function test () outputChatBox ( "Button Pressed" ) end addEventHandler ( "onClientGUIClick", button, test ) ) and wont work what is the problem?? (this and this doesnt work) Search around. People have had exactly the same problem as you and fixed it. Cloudy Link to comment
KaMeR Posted January 15, 2008 Author Share Posted January 15, 2008 ok nevermind my mistake works now Link to comment
Jumba' Posted January 15, 2008 Share Posted January 15, 2008 ok nevermind my mistake works now can you post the fixed code? it may help the people who get the problem that you have.. Link to comment
KaMeR Posted January 15, 2008 Author Share Posted January 15, 2008 ok nevermind my mistake works now can you post the fixed code? it may help the people who get the problem that you have.. first code works fine Link to comment
Frank-De-Ruiter Posted January 15, 2008 Share Posted January 15, 2008 But how can you make like more buttons in 1 .lua file because like: button = guiCreateButton( 0.1, 0.2, 0.10, 0.03, "Admin!", true, WindowForm ) addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()), function ( ) if (source == button) then outputChatBox ( "Admin! I Need You!, Help Me!!" ) end end ) button = guiCreateButton( 0.1, 0.2, 0.10, 0.03, "Admin!", true, WindowForm ) addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()), function ( ) if (source == button) then outputChatBox ( "Admin! I Need You!, Help Me!!" ) end end ) etc... That doesnt work at mine then it only displays 1 button. Can someone tell me this? Link to comment
KaMeR Posted January 15, 2008 Author Share Posted January 15, 2008 But how can you make like more buttons in 1 .lua file because like: button = guiCreateButton( 0.1, 0.2, 0.10, 0.03, "Admin!", true, WindowForm ) addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()), function ( ) if (source == button) then outputChatBox ( "Admin! I Need You!, Help Me!!" ) end end ) button = guiCreateButton( 0.1, 0.2, 0.10, 0.03, "Admin!", true, WindowForm ) addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()), function ( ) if (source == button) then outputChatBox ( "Admin! I Need You!, Help Me!!" ) end end ) etc... That doesnt work at mine then it only displays 1 button. Can someone tell me this? button = guiCreateButton( 0.1, 0.2, 0.10, 0.03, "Admin!", true, WindowForm ) button1 = guiCreateButton( 0.1, 0.3, 0.10, 0.03, "Admin!", true, WindowForm ) addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()), function ( ) if (source == button) then outputChatBox ( "Admin! I Need You!, Help Me!!" ) end end ) addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()), function ( ) if (source == button1) then outputChatBox ( "Admin! I Need You!, Help Me!!" ) end end ) etc... ... Link to comment
Frank-De-Ruiter Posted January 15, 2008 Share Posted January 15, 2008 i realy look stupid now dont i Link to comment
KaMeR Posted January 16, 2008 Author Share Posted January 16, 2008 anyone know how use "triggerServerEvent" in it? addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()), function ( ) if (source == button) then outputChatBox ( "Button Pressed" ) end end ) Link to comment
Cloudhunter Posted January 16, 2008 Share Posted January 16, 2008 button = guiCreateButton( 0.1, 0.2, 0.10, 0.03, "Admin!", true, WindowForm ) button1 = guiCreateButton( 0.1, 0.3, 0.10, 0.03, "Admin!", true, WindowForm ) addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()), function ( ) if (source == button) then outputChatBox ( "Admin! I Need You!, Help Me!!" ) end end ) addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()), function ( ) if (source == button1) then outputChatBox ( "Admin! I Need You!, Help Me!!" ) end end ) etc... ... That code is inefficient, having two functions triggered when it could be done in one. button = guiCreateButton( 0.1, 0.2, 0.10, 0.03, "Admin!", true, WindowForm ) button1 = guiCreateButton( 0.1, 0.3, 0.10, 0.03, "Admin!", true, WindowForm ) addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()), function ( ) if (source == button) then outputChatBox ( "Admin! I Need You!, Help Me!!" ) else if (source == button1) then outputChatBox ( "Admin! I Need You!, Help Me!! (1)" ) end end ) Much better Cloudy Link to comment
AlienX Posted January 16, 2008 Share Posted January 16, 2008 Even better: button = guiCreateButton( 0.1, 0.2, 0.10, 0.03, "Admin!", true, WindowForm ) button1 = guiCreateButton( 0.1, 0.3, 0.10, 0.03, "Admin!", true, WindowForm ) addEventHandler ( "onClientGUIClick", button, function (button, state, x, y) outputChatBox ( "Admin! I Need You!, Help Me!!" ) end ) addEventHandler ( "onClientGUIClick", button1, function (button, state, x, y) outputChatBox ( "Admin! I Need You!, Help Me!!" ) end ) Link to comment
KaMeR Posted January 16, 2008 Author Share Posted January 16, 2008 how active jetpack by button? 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