I’m doing a reserved slot system and want to ask you for a little help with it.
To determine how many players are online at the moment I’m doing this:
hook.Add("PlayerConnect", "egm_join_manager_connect", function() print("Player connected") EGM.JoinManager.onlinePlayerNum = EGM.JoinManager.onlinePlayerNum + 1 end) hook.Add("PlayerDisconnected", "egm_join_manager_disconnect", function() print("Player disconnected") EGM.JoinManager.onlinePlayerNum = EGM.JoinManager.onlinePlayerNum - 1 end)
The problem I have is that PlayerConnect is not called for players that were online before the map changes.
So let’s say 20 people are online and the map changes, EGM.JoinManager.onlinePlayersNum would be 0 even if 20 people are connected after the map change.
Is there any better method to get how many players are online? I can’t use #player.GetAll() because players that aren’t spawned (e.g they are in loading screen) need to count too.