SetPlayerFacingPlayer
#4

i think i got it:
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);
}
it should work.... i think
Reply


Messages In This Thread
SetPlayerFacingPlayer - by StrickenKid - 21.03.2009, 15:00
Re: SetPlayerFacingPlayer - by MenaceX^ - 21.03.2009, 15:18
Re: SetPlayerFacingPlayer - by ICECOLDKILLAK8 - 21.03.2009, 15:26
Re: SetPlayerFacingPlayer - by StrickenKid - 21.03.2009, 15:37
Re: SetPlayerFacingPlayer - by MenaceX^ - 21.03.2009, 15:41
Re: SetPlayerFacingPlayer - by StrickenKid - 21.03.2009, 15:46

Forum Jump:


Users browsing this thread: 1 Guest(s)