OP, you can simply use get_playersnum() and check if it's 1 when you need. If you need to check if the player is alone in the server, you can do it when player disconnects. AFAIK it's called when player is already disconnected, but you can set a little task to avoid getting the wrong number.