29.04.2012, 02:55
That will only set the facing angle that the other player has, you are not facing towards the other player!
Use this function:
Use this function:
pawn Код:
stock Float:SetPlayerFaceToPoint( playerid, Float:PointX, Float:PointY )
{
new Float:eX, Float:eY, Float:eZ;
new Float:eAngle;
GetPlayerPos(playerid, eX, eY, eZ);
if(eX > PointX && eY > PointY) eAngle = floatabs(atan2(floatsub(PointX, eX), floatsub(PointY, eY)));
if(eX > PointX && eY <= PointY) eAngle = floatadd(floatabs(atan2(floatsub(eY, PointY), floatsub(PointX, eX))), 270.0);
if(eX <= PointX && eY > PointY) eAngle = floatadd(floatabs(atan2(floatsub(PointY, eY), floatsub(eX, PointX))), 90.0);
if(eX <= PointX && eY <= PointY) eAngle = floatadd(floatabs(atan2(floatsub(eX, PointX), floatsub(eY, PointY))), 180.0);
if(GetPlayerState( playerid ) == PLAYER_STATE_DRIVER) SetVehicleZAngle(GetPlayerVehicleID( playerid ), eAngle);
else SetPlayerFacingAngle(playerid, eAngle);
return eAngle;
}