21.03.2009, 15:37
i think i got it:
i found an old set player facing an x y pos, and made it into setplayerfacingplayer:
it should work.... i think
i found an old set player facing an x y pos, and made it into setplayerfacingplayer:
pawn Code:
stock SetPlayerFacingPlayer(playerid, facingid)
{
new Float:Px, Float:Py, Float: Pa;
new Float:x,Float:y,Float:z;
GetPlayerPos(facingid,x,y,z);
#pragma unused z
GetPlayerPos(playerid, Px, Py, Pa);
Pa = floatabs(atan((y-Py)/(x-Px)));
if (x <= Px && y >= Py) Pa = floatsub(180, Pa);
else if (x < Px && y < Py) Pa = floatadd(Pa, 180);
else if (x >= Px && y <= Py) Pa = floatsub(360.0, Pa);
Pa = floatsub(Pa, 90.0);
if (Pa >= 360.0) Pa = floatsub(Pa, 360.0);
return SetPlayerFacingAngle(playerid, Pa);
}