SA-MP Forums Archive
Help With Getting Directions - 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 Getting Directions (/showthread.php?tid=514875)



Help With Getting Directions - AroseKhanNiazi - 23.05.2014

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


Re: Help With Getting Directions - ball - 23.05.2014

Код:
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



Re: Help With Getting Directions - AroseKhanNiazi - 24.05.2014

can you explain a bit more ??


Re: Help With Getting Directions - TadePoleMG - 10.05.2018

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.


Re: Help With Getting Directions - Sew_Sumi - 10.05.2018

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.