No, why are you looping through the players? get_players already gives you the amount of players which is "iNum". You can specify whether it ignore bots in the flags, look up how to use the function on Google.
Also, I said the player count should be 1. Check against if( iNum == 1 ). client_disconnect is called before get_players and get_playersnum results are updated, so it will give you 1 if the last player disconnected.