ID:158660
 
well this is from chris gayles demo im using it in my game.
mob/proc
Update_Who()
set background = 1
var/Row = 1//used to represent the row which should be used
var/People = list()//use this to represent the people online
var/A = 0//use this to represent the number of people online
winset(src, "P-Main.Who", "cells=0x0")//whipes the who grid clean for the update to come
src << output("<center><font size =1><font color = red>Name","Who:[1],[Row]")//adds the title name to the grid
src << output("<center><font size =1><font color = red>Status","Who:[2],[Row]")//adds the title status to the grid
A += Players//add the number of players online to the temporary var so that it doesnt affect the Players var during the proces
People += Online//add the online people to the temporary list so as to leave the Online list from being affected by the process
Row += 1//add 1 to Row so that what comes next uses row 2 and not row 1
sleep(0)
while(A)//this will loops the process while A is still greater than 0
for(var/mob/M in People)//finds a person in the People list
src << output("<center><font size =1>[M.key]","Who:[1],[Row]")//displays this person's key in the grid
src << output("<center><font size =1>[M.Status]","Who:[2],[Row]")//displays this persons's status in the grid
People -= M//removes the person from the list so there not repeated
Row += 1//makes the Row var increase by 1 so the next process will use the row bellow the current row and wont mess up the system
A -= 1//removes 1 number from A. A's number co-ensides with the number of people in People so when A hits 0 it means there isnt anyone in the list and stops the process
sleep 1//gives a delay of 1/10 seconds to stop infinite loop problems.
if(A == 0)//this will occur once the while(A) stops it'le display the number of players bellow the last name.
src << output("<center><font size =1>Players :","Who:[1],[Row]")
src << output("<center><font size =1>[Players]","Who:[2],[Row]")
Row += 1
..()

The problem is that when i have more than 1 user,and 1 logs off im stuck with 2 players rows.I never worked with grids before so how can i fix this problem?
http://www.byond.com/developer/VicRattlehead/PlayerCount
That might interest you, considering I've little idea what you're trying to do there.
In response to Vic Rattlehead
Failed to download
In response to XperimentX5000
Fixed. Forgot to put the download link the description.
As a note, you do not need to square-bracket the 1 and 2, they'll just return... 1 and 2!

The cells=0x0 should have erased any old entries, are you sure that the ID you gave is correct? Try putting in "Who" and see if that helps (as others use just "Who" instead of you telling what element it can be found in).

Though I must say, this is a rather dread looking snippet (and I do not have any idea why I feel a tad-bit British at the moment). To me, I think it would be simpler to have the players list and the procedure at a global level then a /mob level:
var/tmp/list/People = list()  //  a /list of client's /mob. /tmp makes this variable unsavable. You do not want to save any /mob references! It'll cause problems like roll-backs.

client/New()
..()
if(!(src.mob in People))
People += src // Adds people when they log in, if not there before.
UpdateWho()
client/Del()
if(src in People)
People -= src // You can figure this out.
UpdateWho()
..()

proc/UpdateWho()
for(var/mob/M in People) // Not sure if /list containing /mob reference can be used in winset(), so doing the old fasion way of looping to all
var/row = 0
winset(M, "WhoGridID", "cells=0x0") // Erase old entries
for(var/mob/N in People)
M << output(N, "WhoGridID:1,[row]")
M << output(N.status, "WhoGridID:2,[row++]") // row++ = returns current value of row then adds 1.
In response to GhostAnime
If Logout() is called first, nothing will happen after that >_>;
Although, I would recommend it be done with client/New()/Del(), aka, my Player Count library.
In response to Vic Rattlehead
Oops, forgot about moving that ..() in Logout() >_>