Jump to content

Do event for every element in function


Piorun

Recommended Posts

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?

Link to comment

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?

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