i is a zone index, not a player index. I assume there's only one zone, so that's why it works only for the first player, because zone 0 = player 0, they have the same indexes.
You need to loop all players in addition to the zones loop, or assign a different task for each player or each zone, then do only one loop inside the function.