You could just put this in your init.sqs:
;init.sqs - player detection
;
player_pool = [player1,player2,player3,player4,player5,player6,player7,player8,player9,player10,player11,player12]
player_array = []
"if (alive _x) then {player_array = player_array + [_x]}" forEach player_pool
all you need change of course is;
playerx to whatever name you gave your players, and the
names of the arrays
No need for local/global, as init.sqs will be run everywhere and
so the check for presence of the units - no queries about wether local or global in this case.
And setposs'ing a player unit should be global anyway (as i
reckon setpos to be a global command).
:edit - oh i forgot to explain what the init.sqs script does;
first you put all playable units into an array (player_pool), and second you proove this array for present units (not disabled in player selection screen), and put them into another array (player_array)
~S~ CD