That would require a lot more than editing memory offsets though.
It's a bit slow, but you could grab the player ID, then check if the player is on your team or not and then fire. Either by sending a mouse input, or if I remember correctly by writing to a specific address.
However, with enough knowledge (which is mostly documented online) you could actually pull out the hitbox, skeleton and animation data and just run the line-box intersection step yourself. Easier to do internally by hooking in-game functions though.
or the game engine could track internally what the player is looking at (GTA does this).