Checking if player is facing in Player
#1

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:

> <

-----
Reply
#2

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;
    }
}
Reply
#3

Thank you.
Reply
#4

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 ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)