Help With Getting Directions
#1

How can i get that is the player west,east,south or north to the target player
Reply
#2

Код:
A       |      B
        |       
        |       
--------i-------
        |       
        |       
C       |      D
Point i = 0.0, 0.0 (x, y) - you can use GetPlayerPos.

Код:
new Float:p[3];
GetPlayerPos(playerid, p[0], p[1], p[2]);

if(p[0] > 0.0 && p[1] < 0.0) //the player is in area A
else if(p[0] > 0.0 && p[1] > 0.0) //the player is in area B
else if(p[0] < 0.0 && p[1] < 0.0) //the player is in area C
else if(p[0] < 0.0 && p[1] > 0.0) //the player is in area D
Reply
#3

can you explain a bit more ??
Reply
#4

Hi Bhaijan

PHP код:

new AngleGetPlayerFacingAngle(playeridAngle);
if(
Angle45 || Angle315) print("North");
if(
Angle225 && Angle315) print("West");
if(
Angle135 && Angle225) print("South");
if(
Angle45 && Angle135) print("East"); 
Some direction defines-
360 - North
315 - North-West
270 - West
225 - South-West
180 - South
135 - South-East
090 - East
045 - North-East
0 - Same as 360, North

Thank You.
Reply
#5

What ball said is best. It's not the facing angle, it's the positions.

Area A is North West, Area B is North East, C is South West, D is South East.

If you check the difference between the players x and y coordinates, it will get you a closer idea as to which direction they are in, but the simplest, is what ball has shown.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)