Help with facing angle - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help with facing angle (
/showthread.php?tid=442476)
Help with facing angle -
Richie© - 07.06.2013
My player is at one point and i want them to face to another point.
How do i use SetPlayerFacingAngle to do this? Since its 0-360 degree angle i have no clue how to.
Is there anything like SetPlayerFacingToPoint(playerid, x, y, z); ?
I have a picture here to help you understand what i want
Re: Help with facing angle -
DobbysGamertag - 07.06.2013
Ok, first. Get to the postition you want the player to stand at. Do /rs. The last part ignore, use:
pawn Code:
SetPlayerPos(playerid,X,Y,Z);
Then find the direction you want the player to face, turn that direction. Do /rs again and use the last bit as this:
pawn Code:
SetPlayerFacingAngle(playerid,ANGLE);
Here's an example:
pawn Code:
1767.3073,-2024.1143,14.1494,222.3893
pawn Code:
SetPlayerPos(playerid,1767.3073,-2024.1143,14.1494);
SetPlayerFacingAngle(playerid,222.3893);
The SetPlayerFacingAngle is the very last part of /rs (raw save) which will save in your GTA San Andreas User Files.
Hope you understood
Re: Help with facing angle -
Richie© - 07.06.2013
Thanks for reply, but its not really what i need. I need somehow to calculate the facing angle from the current pos to another pos. /rs will ofc get me facing angle, but the script will constantly need the facing angle updated while player is on the move.
Re: Help with facing angle -
Pottus - 07.06.2013
I see what you mean, you want to teleport the player to a point and have them face at a specific point.
https://sampforum.blast.hk/showthread.php?tid=28664&page=3
Re: Help with facing angle -
Richie© - 07.06.2013
Thanks Pottus