Jump to content

guiLabel ID (for getText)


Artisz

Recommended Posts

Hi!

I want to make a faction list, but how can I add to the guiLabel an own ID, that I can

distinguish it. When I click on it, write the clicked label's text. I can't do it.

Here is the code:

for k, v in ipairs(getJatekosFrakciok()) do 
                    szamlalo = szamlalo + 1 
                    lista = k 
                    lista = guiCreateLabel(X+370, (Y+100)+k*30, 400, 200,getFrakcionevByID(v),false) 
                end 
  
  
addEventHandler("onClientClick", getRootElement(), function(gomb, statusz, absX, absY) 
        if statusz == "down" and gomb == "left" then 
             
            for i = 1,szamlalo do 
                if dobozbaVan(X+370, (Y+100)+i*30, 130,30, absX, absY) then 
                       outputChatBox(i) 
                       text = guiGetText(lista) 
                       outputChatBox(text) 
               end 
            end 
        end 
end) 

At this line:

outputChatBox(i) 

It is write it correct(1,2,3, etc.) but at these lines:

text = guiGetText(lista) 
                       outputChatBox(text) 

It is just write the latest created label's text(faction name), never mind, that I click the first or the latest faction name(label)

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