Jump to content

Remove row when player leave


#meS

Recommended Posts

guiGridListRemoveRow takes in the row id to remove. You need to loop through the rows and check which one has that player name and remove that row.

for row = 0, guiGridListGetRowCount(gridplayers) - 1 do 
 if (guiGridListGetItemText(gridplayers, row, 1) == getPlayerName(source)) then 
  guiGridListRemoveRow(gridplayers, row) 
 end 
end 

Link to comment

Ok thank you but how to remove the rows near it? like i did near the player name ping row how to remove it when he leave?

like this maybe?

function remove() 
for row = 0, guiGridListGetRowCount(gridplayers) - 1 do 
 if (guiGridListGetItemText(gridplayers, row, 1) == getPlayerName(source)) or (guiGridListGetItemText(gridplayers, row, 1) == getPlayerPing(getPlayerName(source) then 
  guiGridListRemoveRow(gridplayers, row) 
 end 
end 
addEventHandler("onClientPlayerQuit",root,remove) 

Link to comment

thank you but why getting player team doesn't work?

  
for id, playeritem in ipairs(getElementsByType("player")) do  
local row = guiGridListAddRow ( SRB.gridlist[1] ) 
guiGridListSetItemText ( SRB.gridlist[1], row, 1, getPlayerName ( playeritem ), false, false ) 
guiGridListSetItemText ( SRB.gridlist[1], row, 2, getTeamName (getPlayerTeam( playeritem )), false, false ) 
guiGridListSetItemText ( SRB.gridlist[1], row, 3, getElementData( playeritem ,"job"), false, false ) 
guiGridListSetItemText ( SRB.gridlist[1], row, 4, getPlayerPing( playeritem ), false, false ) 
guiGridListSetItemText ( SRB.gridlist[1], row, 5, getElementData( playeritem,"FPS"), false, false ) 

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