Beispiel #1
0
        public static void OnCreateMove(CUserCmd *pCmd)
        {
            if ((pCmd->buttons & IN_ATTACK) == 0)
            {
                return;
            }

            PlayerHelper pEntity = GetTarget(pCmd);

            if (!pEntity.IsValid())
            {
                return;
            }

            QAngle targetAngle = SpacialUtils.CalcAngle(Utils.GetLocalPlayer().GetEyePos(), pEntity.GetEyePos());

            targetAngle.Normalize();
            pCmd->viewangles = pCmd->viewangles.Add(targetAngle.Subtract(pCmd->viewangles).Divide(2));
            pCmd->viewangles.Normalize();
        }