ID:272610
 
ok, i really just forgot how to make a who verb, if anyone could help me i would greatly appreciate it, just one that says Whos online and how many all together
Use a for list loop. Namely, something like the following:
for(var/client/c)
Instead of a verb, why not put it in a stat panel?

var/players = 0
mob/Login()
..()
world << "[src.name] has joined the game"
players++
mob/Logout()
..()
world << "[src.name] has left the game"
players--

mob/player
Stat()
statpanel("Online")
stat("Players Online: [players]")
for(var/mob/player/M in world)
if(M.client)
stat("\t\t[src.name]")


Should work fine
In response to Morpholic
Don't use for(var/mob/m in world) and then check if the mob has a client. Just check the clients directly.
In response to Popisfizzy
When I do that players stays equal to 1, but it prints the players name around...100 times or so. That's using

 
for(client in world)
stat("\t\t[src.name]")


I unno it's 3:37 AM maybe I'm just tired >.<
In response to Morpholic
...how does that even make sense?

for(var/client/c)
stat("[c.key]")
In response to Morpholic
Looping through all players (or looping generally) on Stat() is very wasteful - it's going to do the same loop every 1-3 ticks for each player. Not only that, it most of the time will do it just to display the same values again, since players don't [dis]connect in lapses of 1/10 seconds. You should use a global players list, then just display it as it'd be pre-made. You can also use the len var to see how many players are logged in.
var/list/players = new() //define a new global list and initialize it
client
New() //when a player logs in
. = ..() //do the regular stuff
players += src //add the connected player to our list

Del() //when a player is deleted
players -= src //remove him from the list
return ..() //do normal stuff
Stat()
if(statpanel("Players",players)) //display the players list
//if the Players statpanel is selected, then
stat("Total:",players.len) //display the total amount of players in it
In response to Morpholic
I tried yours first but it didn't work then i did

mob/Player
Stat()
statpanel("Who's Online")
stat("Players Online: [players]")
for(client in world)
stat("\t\t[src.name]")



and this says Maximum Number Of Stats Met when i start the game and it freezes

In response to Ralphie_leo
As pointed out already by Popisfizzy, that guy's code made no sense. It clearly won't work.
In response to Kaioken
How do I get the below code to display each mobs' overlays along with their icon? Right now it just shows their base icon.
mob/Stat()
statpanel("Online Players")
stat(OnlinePlayers)
stat("Total:",OnlinePlayers.len)
..()
In response to Mizukouken Ketsu
It should actually work completely fine for displaying overlays, AFAIK, and should do that with your code if the list has mob references (which I deduce you've made it keep track of those instead of the clients). Maybe you can provide more info, and ensure it's really overlays that are missing.
In response to Kaioken
Oh sorry. I must not have tested it before posting. It does work. Sorry lol.