Jump to content

guiGridListGetselectedItem problem [Fixed]


aintaro

Recommended Posts

Hello guys,

I've been trying to fix this error for a few days now and still nothing, it drives me crazy can sombody please clarify this:

here is my client side code :

function createPlayerList () 
        -- Create the grid list 
        shoppingList = guiCreateGridList ( 0.80, 0.10, 0.15, 0.60, true ) 
        -- Create a players column in the list 
        local column = guiGridListAddColumn( shoppingList, "Player", 0.85 ) 
        if ( column ) then         -- If the column has been created, fill it with players 
                for id, playeritem in ipairs(getElementsByType("player")) do 
                        local row = guiGridListAddRow ( shoppingList ) 
                        guiGridListSetItemText ( shoppingList, row, column, getPlayerName ( playeritem ), false, false ) 
                        local playerName = guiGridListGetItemText ( shoppingList,0, 1) 
                        outputChatBox(playerName) 
                end 
                addEventHandler ( "onClientGUIClick", shoppingList, click ) 
        end 
            -- enable the players cursor (so they can select and click on the components) 
            showCursor(true) 
        -- set the input focus onto the GUI, allowing players (for example) to press 'T' without the chatbox opening 
            guiSetInputEnabled(true) 
end 
addEventHandler ( "onClientResourceStart", getRootElement(), createPlayerList ) 
  
function click ()  
       local playerName = guiGridListGetItemText ( shoppingList, guiGridListGetSelectedItem ( shoppingList ), 1 ) 
       ouputChatBox("name : " ..playerName) 
       end 

here is my output of my debugscript :

aXfMIXV.png

Edited by Guest
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...