You can check if a unit exists by using the alive command. Maybe it doesn't work here, but you can always try... (Don't know exactly what you're trying to do.)
To know if a unit is a player, use the skill command. The players always have the skill set to 1. (Avoid giving the other units the skill of 1 for this to work...)