How to list _ALL_ players from server

Ok, now this seems like a stupid question that should have a simple answer, but doesn’t seem to be the case.

Why can i not seem to gather any data at all on the players that are connecting?

If it says “connecting” or “spawning”, player.GetAll() does not return them as a player.

Now, although this does make sense given that the player is not yet a valid entity, i should still be able to get a list of steamids that are connecting to my server.
Question is, How?

The problem specifically occurs between map restarts.
How am i supposed to maintain a list of players after the server initializes but before the players run :InitialSpawn()?

And before anyone says use GM:PlayerConnect or GM:PlayerAuthed or GM:CheckPassword, please put the following debug code on a server, join the server, then do a map restart with changelevel gm_construct.
Notice that NONE of the auth functions are called for players that maintain their connection through the restart until their :InitialSpawn is called, so what am i supposed to do?

Now then, before anyone tells me to go the long way round and do some sort of, record the connected player data into a text file and use that after the restart.
Not only does this sound like a very hacky way to go about this, it also isn’t very reliable.
If a player disconnects between the restart beginning and until their next GM:PlayerAuth hook call, the GM:PlayerDisconnected will NOT be called for the player.

So it’s like not only do i NOT have a list of players, i also can’t tell who is and is not connecting.
Like, it seems odd to me that this data is not available using lua.


You can’t get info from the player object because it doesn’t exist. CheckPassword still returns all the info you need to log them, though.

hook.Add("CheckPassword", "Log Joins", function(sid, ip, _, _, name)
	ServerLog(name .. " (" .. sid .. ") has joined with the IP '" .. ip .. "'.

This is no good because as i have stated;

The only remaining fix for players disconnecting beyond this already very hacky workaround is to use a timeout of like 5~10 minutes.

I’d like to avoid such a hacky solution to a seemingly simple problem.

Unless this is the only way T_T.

Garry plz fix your sh*t plzkthnx <3

There is no way without logging in PlayerConnect/Disconnect.

Check examples 2 and 3.

That is still logging, though.

Brilliant, this works just fine.

Doesn’t avoid the requirement of some form of logging, but, at least i won’t be entirely blind to disconnects and joins between restarts.