Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stock SetPlayerFacePoint(playerid, Float:x, Float:y) {
- if (playerid < 0 || playerid >= MAX_PLAYERS)
- return 0;
- new Float:px, Float:py, Float:pz;
- GetPlayerPos(playerid, px, py, pz);
- new Float:angle = acos((x - px) / floatsqroot(((x - px) * (x - px)) + ((y - py) * (y - py)));
- if (y > py)
- angle = -angle - 90.0;
- else if (y < py && x < px)
- angle -= 450.0;
- else if (y < py)
- angle -= 90.0;
- if (x > px)
- angle = floatabs(angle) + 180.0;
- else
- angle = floatabs(angle) - 180.0;
- return SetPlayerFacingAngle(playerid, angle);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement