Instead, try to rely on the UTIL functions provided in the Half-Life SDK to do vector arithmetic and let the numbers work themselves out. Nearly everything in the Half-Life SDK inherits from CBaseEntity. What this means it that all of these objects have some things in common. This location will be an 3 element array containing the X, Y and Z coordinate of the player. Notice how I skip over players that are dead or dying.
Pitch is the angle leaning forward or backward.
Yaw is the angle turning left or right.