Jump to content

Gridlist Problem


Khalil

Recommended Posts

Hello.

I made a gridlist to get all players in the server. I do the command to open the gui and it looks fine. I close the gui, and open it again, then I find three of the same player on the gridlist, I don't know what to do, here's the code:

function showGUI ( ) 
        local tostate = not guiGetVisible ( win ) 
        guiSetVisible ( win, tostate ) 
        showCursor ( tostate ) 
for index, player in ipairs ( getElementsByType ( 'player' ) ) do 
 if ( player ~= localPlayer ) then 
  guiGridListSetItemText ( gridList, guiGridListAddRow ( gridList ), 1, getPlayerName ( player ), false, false ) 
 end 
end 
end 
addCommandHandler("aj",showGUI) 

Link to comment
function showGUI ( ) 
        local tostate = not guiGetVisible ( win ) 
        guiSetVisible ( win, tostate ) 
        showCursor ( tostate ) 
       guiGridListClear(gridList) 
for index, player in ipairs ( getElementsByType ( 'player' ) ) do 
 if ( player ~= localPlayer ) then 
  guiGridListSetItemText ( gridList, guiGridListAddRow ( gridList ), 1, getPlayerName ( player ), false, false ) 
 end 
end 
end 
addCommandHandler("aj",showGUI) 

Link to comment
  
function refreshGUI() 
  
 guiGridListClear(gridList) 
for index, player in ipairs ( getElementsByType ( 'player' ) ) do 
 if ( player ~= localPlayer ) then 
  guiGridListSetItemText ( gridList, guiGridListAddRow ( gridList ), 1, getPlayerName ( player ), false, false ) 
 end 
end 
  
end 
  
  
  
addEventHandler( "onClientPlayerQuit", getRootElement(), refreshGUI )  

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