ID:163676
 
mob/proc/Who()
var/list/playersonline = new()
for(var/mob/M in world)
if(M.client)
playersonline += M
src << output("[playersonline]","output2")



Any idea why this wont update when someone comes online. I got this for an idea but I'm not sure about it.

var
list
whopannel = list()

mob
Login()
..()
whopannel += src
Logout()
..()
whopannel -= src

mob/proc/Who()
src << output("[global.whopannel]","output2")
Miran94 wrote:
> mob/proc/Who()
> var/list/playersonline = new()
> for(var/mob/M in world)
> if(M.client)
> playersonline += M
> src << output("[playersonline]","output2")
>

Any idea why this wont update when someone comes online

First of all do you call the proc for the whole world when someone new logs in? Also is that the right output?
In response to Crunched
Yes its the right output and what do you think the new way I did it is right?
What I basically did was use a output as the players online list. Once someone new comes online instead of refreshing it would add the player's name to the list like this:

proc
UpdatePlayersOnline(var/mob/Q)//Just adds a name to the list and players online with no refresh
players.Add("[Q.key]")
world<<output({"* [Q]"},"PlayersOnline")


The player who comes online will get a new list like this:
    LogRefresh(var/mob/Q)//Login Refresh for user only

Q<<output(null,"PlayersOnline")
Q<<output("Players Online: [PlayersOnline]/[maxplayersplaying]","PlayersOnline")
Q<<output("Players Playing: [PlayersPlaying]","PlayersOnline")
for(var/I in players)
Q<<output({"* [I]"},"PlayersOnline")


At last, once someone leaves it will refresh the world.
    UpdatePlayersOffline(var/mob/Q)//Refresh
world<<output(null,"PlayersOnline")
world<<output("Players Online: [PlayersOnline]/[maxplayersplaying]","PlayersOnline")
world<<output("Players Playing: [PlayersPlaying]","PlayersOnline")
players.Remove("[Q.key]")
for(var/I in players)
world<<output({"* [I]"},"PlayersOnline")


All together:
mob
Login()
UpdatePlayersOnline(src)
LogRefresh(src)

mob
Logout()
PlayersOnline--
UpdatePlayersOffline(src)
del(src)


Hopefully this will help you out.