Checking if player is facing in Player - 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: Checking if player is facing in Player (
/showthread.php?tid=382831)
Checking if player is facing in Player -
JaKe Elite - 05.10.2012
I know this question is stupid but GetPlayerAngle doesn't work.
It just returns where player angle is facing at.
For Newbie don't post here if you don't know the question.
So how to check if player is facing another player
like this
-----
Example Board:
> <
-----
Re: Checking if player is facing in Player -
[XST]O_x - 05.10.2012
I haven't scripted for a while now, but maybe something like this can work:
pawn Код:
GetPlayerFacingPlayer(playerid)
{
new Float:Angle_Player1, Float:Angle_Player2;
GetPlayerFacingAngle(playerid, Angle_Player1);
for(new i = 0; i < MAX_PLAYERS; i++)
{
GetPlayerFacingAngle(i, Angle_Player2);
if(floatround( floatabs( Angle_Player2 - Angle_Player1 ) ) == 180) {
return i; }
else return INVALID_PLAYER_ID;
}
}
Re: Checking if player is facing in Player -
JaKe Elite - 05.10.2012
Thank you.
AW: Checking if player is facing in Player -
Nero_3D - 05.10.2012
This wont work because there is no tolerance at all.
Also do you want to check if both players are facing each other or just one player facing another one ?