Piorun Posted June 17, 2011 Posted June 17, 2011 Hi. Firstly - my lua code: Button = {} Button[1] = guiCreateLabel(8,0,59,20,"Postacie",false) guiLabelSetHorizontalAlign(Button[1],"center",false) Button[2] = guiCreateLabel(77,0,59,20,"Przyjaciele",false) guiLabelSetHorizontalAlign(Button[2],"center",false) Button[3] = guiCreateLabel(146,0,59,20,"Statystyki",false) guiLabelSetHorizontalAlign(Button[3],"center",false) Button[4] = guiCreateLabel(215,0,40,20,"Opcje",false) guiLabelSetHorizontalAlign(Button[4],"center",false) Button[5] = guiCreateLabel(265,0,47,20,"Pomoc",false) guiLabelSetHorizontalAlign(Button[5],"center",false) addEventHandler( "onClientGUIClick", Button, zmienKolor, false ) Ok, i have this one. I want to add this Event for every "Button" element in this function. How?
JR10 Posted June 17, 2011 Posted June 17, 2011 for i, v in ipairs(Button) do addEventHandler( "onClientGUIClick", v, zmienKolor, false ) end Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
Piorun Posted June 17, 2011 Author Posted June 17, 2011 Ok, but when i add this i didn't see my rectangle (this is my rest of function): function controlPanel() Button = {} Button[1] = guiCreateLabel(8,0,59,20,"Postacie",false) guiLabelSetHorizontalAlign(Button[1],"center",false) Button[2] = guiCreateLabel(77,0,59,20,"Przyjaciele",false) guiLabelSetHorizontalAlign(Button[2],"center",false) Button[3] = guiCreateLabel(146,0,59,20,"Statystyki",false) guiLabelSetHorizontalAlign(Button[3],"center",false) Button[4] = guiCreateLabel(215,0,40,20,"Opcje",false) guiLabelSetHorizontalAlign(Button[4],"center",false) Button[5] = guiCreateLabel(265,0,47,20,"Pomoc",false) guiLabelSetHorizontalAlign(Button[5],"center",false) for i,v in ipairs(Button) do addEventHandler( "onClientGUIClick", v[i], zmienKolor, false ) end -- Direct X Drawing addEventHandler("onClientRender",root, function() dxDrawRectangle(0.0,0.0,1024.0,20.0,tocolor(0,0,0,191),false) end ) end why?
JR10 Posted June 17, 2011 Posted June 17, 2011 I made a mistake for i, v in ipairs(Button) do addEventHandler( "onClientGUIClick", v, zmienKolor, false ) end Sorry have been working on something for 5 hours so far Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
Piorun Posted June 17, 2011 Author Posted June 17, 2011 Don't worry . My next problem. I create a function "zmienKolor" and it doesn't works function zmienKolor() guiLabelSetColor(v, 255, 0, 0) end after click of cors..
JR10 Posted June 17, 2011 Posted June 17, 2011 Hmm, v i think is the botton like i gave it to you not a label Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
Castillo Posted June 17, 2011 Posted June 17, 2011 Why do you need the function? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Piorun Posted June 17, 2011 Author Posted June 17, 2011 Because i'm creating a control panel for every players, and i want to create simple menu i the top of the screen and i want just test this function
JR10 Posted June 17, 2011 Posted June 17, 2011 function zmienKolor() guiLabelSetColor(source, 255, 0, 0) end Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
JR10 Posted June 17, 2011 Posted June 17, 2011 No problem. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
Castillo Posted June 17, 2011 Posted June 17, 2011 Ah, my bad, I didn't know what was you trying to do . San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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