DListview live health & players

So i want to make my custom thingy, but i dont know how to make Health & the players live & how many players there are online. it there any way? my code right now =


 
local frame = vgui.Create( "DFrame" )
frame:SetPos(50,50)
frame:SetSize( 500,500 )
frame:ShowCloseButton(true)
frame:MakePopup()

local lista = vgui.Create( "DListView", frame )
lista:SetMultiSelect( false )
lista:SetPos(0,20)
lista:SetSize(500,500)
lista:AddColumn( "Players" )
lista:AddColumn( "Health" )

lista:AddLine( "player", "100" )







for k,v in pairs( player.GetAll() ) do
    lista:AddLine( v:Nick(), v:Health() )
end


I suggest you do something like this when adding players

[lua]for k, v in pairs( player.GetAll() ) do
local l = list:AddLine( v:Nick(), v:Health() )
l.Player = v
end[/lua]
Then to update
[lua]
for k, l in pairs( list:GetLines() ) do
if not IsValid( l.Player ) then list:RemoveLine( k ) continue end
l:SetColumnText( 2, l.Player:Health() )
end[/lua]

thank you both app it :slight_smile:
do you also know a way to when you click on it, it targets the player you click on and you get a menu where you can change for example his health? or is that not possible