Is Object in front of 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 Object in front of player? (
/showthread.php?tid=522717)
Is Object in front of player? -
Hantex. - 28.06.2014
How can i detect if a player is in front of an object?
Re: Is Object in front of player? -
Jefff - 28.06.2014
IsPlayerInArea function
Re: Is Object in front of player? -
Hantex. - 28.06.2014
Quote:
Originally Posted by Jefff
IsPlayerInArea function
|
IsPlayerInArea doesn't look the angle of the player/object
Re : Is Object in front of player? -
S4t3K - 28.06.2014
GetPlayerCameraFrontVector should work to detect where exactly does the player look at.
Re: Is Object in front of player? -
Hantex. - 28.06.2014
I need that the Angle of the player is in front of an object and not the Player camera.
Re: Is Object in front of player? -
Jefff - 28.06.2014
So just create area in front of object and next
if(IsPlayerInArea(areaid))
{
// code
}
Re : Is Object in front of player? -
S4t3K - 28.06.2014
The problem is the same Jeff : how to detect where the "front of object" is ?
Re: Is Object in front of player? -
Hantex. - 29.06.2014
Quote:
Originally Posted by Jefff
So just create area in front of object and next
if(IsPlayerInArea(areaid))
{
// code
}
|
Doing this I still have to see if the player is in front of the object
Respuesta: Is Object in front of player? -
angelxeneize - 29.06.2014
use GetPlayerCameraFrontVector and check X And Y object pos. If X and Y camera = X and Y object bla bla bla
Re: Is Object in front of player? -
Pottus - 29.06.2014
Give this a shot you can use a value higher than 150.0 if you want.
pawn Код:
stock IsPlayerInFrontOfPoint(playerid, Float:x, Float:y, Float:z, Float:dist=150.0)
{
new Float:px, Float:py, Float:pz;
GetPlayerPos(targetid, px, py, pz);//my pos
GetXYInFrontOfPlayer(targetid,px,py,dist);
if(GetDistance(x,y,z,px,py,pz) <= dist)return 1;
return 0;
}