SA-MP Forums Archive
Is Point right or left from 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: Is Point right or left from player (/showthread.php?tid=390555)



Is Point right or left from player - Azazelo - 06.11.2012

How to detect is point left or right from player?


left point < Player Point > right point
(x,y,z) (x,y,z) (x,y,z)

Quote:

IsLForRG(playerid,Float,Float:y,Float:z)
{
new Float:X,Float:Y,Float:Z,Float:Ang;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, Ang);
//And now what??

}




Re: Is Point right or left from player - adsy - 07.11.2012

I'm probably miles off as I am on lunch at work without a samp server to test but see if that helps?

Код:
if(ang > 90 && ang < 270){ //player is facing southways
    if(pointx < X) //left in north //right in south
    if(pointx > X) //right in north //Left in South
}
else {//player is facing northways
    if(pointx < X) //left in north //right in south
    if(pointx > X) //right in north //Left in South
}
I didnt have the mind to think about the y axis but works similar i'm sure