SA-MP Forums Archive
Player angle and walls detection - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Player angle and walls detection (/showthread.php?tid=125480)



Player angle and walls detection - arnutisz - 04.02.2010

Is it possible to do these things in sa-mp:
- Detect the wall in front of you, or any kind of object that is not created by server?
- Set player or vehicle X, Y angle?

If its not possible with pawn, maybe possible with plugin?


Re: Player angle and walls detection - Joe Staff - 04.02.2010

well, you might with the first one. using a map scale you can detect if the map infront of the player has a Z coordinate higher than the player.


Re: Player angle and walls detection - ettans - 04.02.2010

You could try to implement this with Joe Staff's suggestion. Though you'd need to make sure the object is not a mountain.


Re: Player angle and walls detection - arnutisz - 04.02.2010

And what about X, Y angle? Any suggestions?


Re: Player angle and walls detection - Correlli - 04.02.2010

Quote:
Originally Posted by Scott[LT
]
- Set player or vehicle X, Y angle?
No, you can only set/get the Z angle.


Re: Player angle and walls detection - mansonh - 04.02.2010

as for detecting walls etc
There is a mysql database plugin which has map heights, so you can find the z coordinate which includes building tops etc.
[REL,beta] MapAndreas plugin v1.0

So to detect a wall use this function with distance to detect a wall(think its ******'s code):
Code:
stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
	new Float:a;
	GetPlayerPos(playerid, x, y, a);
	GetPlayerFacingAngle(playerid, a);
	x += (distance * floatsin(-a, degrees));
	y += (distance * floatcos(-a, degrees));
}
Then use the mysql to determine the z coordinate, if its higher than you are, you have a wall.