Jump to content

Remove row when player leave


#meS

Recommended Posts

Posted

hello I want to remove row when player leave like i want to remove the player name who left the game from the grid list how to do that?

Hi

Posted

Ok I know the function but .. Ah idk how to remove the left player this gonna work?

function remove() 
guiGridListRemoveRow( gridplayers,getPlayerName(source)) 
end 
addEventHandler("onClientPlayerQuit",root,remove) 

Hi

Posted

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 

Business System viewtopic.php?f=108&t=35797

Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726

SQLite Tutorial viewtopic.php?f=148&t=38203

Posted

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) 

Hi

Posted

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 ) 

Hi

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