Playerid Facing to ID?
#4

That will only set the facing angle that the other player has, you are not facing towards the other player!
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;
}
Reply


Messages In This Thread
Playerid Facing to ID? - by Admigo - 28.04.2012, 19:34
Re: Playerid Facing to ID? - by SnG.Scot_MisCuDI - 28.04.2012, 19:53
Re: Playerid Facing to ID? - by Crazymax - 29.04.2012, 02:20
Re: Playerid Facing to ID? - by admantis - 29.04.2012, 02:55
Re: Playerid Facing to ID? - by Crazymax - 29.04.2012, 03:27

Forum Jump:


Users browsing this thread: 1 Guest(s)