ID:142475
 
Code:
mob/Login()
src.loc=locate(1,1,1)
if(players < limit)
src.players += 1
world << "<b><font color=blue>[src] has entered the game. ([time2text()])"
if(src.key == "Howey")
src.verbs += typesof(/mob/host/verb)
src.GM = 1
else
src << "Sorry but we're full right now."
del(src)
src << browse(messagenote,"window=Message Note")


mob/Stat()
statpanel("World")
stat("Player Limit:","[limit]")
stat("Number Of Players:","[players]")
for(var/mob/M in world)
if(M.GM)
stat("(Admin) [M.name]"," [M.afkness]")
else
stat("[M.name]"," [M.afkness]")


Problem description:
    stat("Number Of Players:","[players]")

When the host logs in, the number changes to one, but when anybody else logs it, it doesn't change to 2,3,4,5,...
You need to make sure that you have players defined as a global var, like this:
mob/var/global/players
In response to Hazman
the /global variable is useless in DM.

In DM, when people say to define something globally, they mean define it under no atoms, not with /global:
var/list/players[0]   // Initializes the global-list players with a length of 0
// Note the lack of /mob, /atom, etc in front of var


EDIT: Read what Kaio said in his other post. What most people do is make the players list contain the mob of the players and they get the size of the list via length() or List.len
In response to Hazman
You don't need this to be a /mob variable, so you don't need the global notation either (it's generally quite rare when you do). This will make a global variable:
var/players //just don't define it under anything, put it on the left-most level


Also, if all you're doing here is using a count variable, it isn't going to be very costly at all to calculate each time, (like this:
var/count
for(var/client/C) count++

so you don't really need a global variable for this. A global list containing references to players would be generally more useful.
In response to GhostAnime
GhostAnime wrote:
the /global variable is useless in DM.

Actually, it works. It isn't highlighted for nothing, but it is rarely needed, though, and you should use the method you posted. Look it up in the DM Reference for more info.
In response to Kaioken
Hm really? That's interesting.
In response to GhostAnime
Erm, actually testing proves otherwise:
mob
Login()
..()
for(var/a in 1 to 10)
new/obj()

obj
var
global/ids
id
New()
id = ++ids
world << id

Outputs:
1
2
3
4
5
6
7
8
9
10

Showing that the /global variable has indeed kept the ids var global to all /obj atoms.
In response to Hazman
Kaioken already mentioned it works. But yeah, my bad, should've tested it before going all gung ho.
In response to Hazman
Hazman wrote:
Showing that the /global variable has indeed kept the ids var global to all /obj atoms.

Indeed, this works, but regardless, why should you want to use such a variable with an object? This just requires you to do extra work to access it from the object while making it impossible to access it without such an object on-hand. What I'd find the global syntax useful for is limiting certain global variables to be used only in their respective procs, when they're not needed otherwise, like exampled in the DM Reference and here[[link]]. It doesn't seem more useful than a "normal" global variable for other cases.
In response to Kaioken
Hazman's example is a perfect example of why you'd want to use the global identifier. It keeps you from having to rack up a bunch of permutations on "ids" if you want to track the numbers of different types (IE: "mobids" "objids" "areaids").