Never use get_maxplayers() or get_playersnum() in or as part of a for loop. Also, if a user is alive, they are connected (the is_user_alive() check already checks if they are connnected).
Anyways, you should use the get_players() native. This will already give you only players that are connected.
Also, your function doesn't do anything and your description of what you want makes no sense. You need to explain in detail what you are wanting (something that can be understood).
@Baws, wow, that is just horrible. Stop trying to help people when you have no idea of what you are doing.