Im working with the source sdk (Which uses c++) and I want to rotate a entity's angle so it looks at another entity.
A entity can be looked at as a gameobject or similar and has a position (Vector) in the world as well as a angle (Vector).
I can rotate the entity by using SetAbsAngles which takes a QAngle (Basically a Vector) as parameter.
Here is some pseudo-code:
The z-rotation is set to 0 because it cannot be determined. You can set it freely if you like.
This works in a coordinate system with z facing forward, y up and x to the right. If you are using a different system you may have to adjust some signs.