Playerid Facing to ID?
#1

Heey all,
I want to detect the location of the ID of arrest.
Then i want to set the angle for playerid so when he arrest him he facing him.
I need this for the aiming animation.
Example:
Код:
           0

270  playerid    90


           ID
          180

//so you see Id is south of him so the playerid angles to 180.
How can i make this?

Thanks Admigo
Reply
#2

pawn Код:
GetPlayerFacingAngle
Then
pawn Код:
SetPlayerFacingAngle
Reply
#3

easy...

pawn Код:
//In your command (arrest)
new Float:A;
GetPlayerFacingAngle(id, A);
SetPlayerFacingAngle(playerid, A);
Reply
#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
#5

Quote:
Originally Posted by admantis
Посмотреть сообщение
That will only set the facing angle that the other player has, you are not facing towards the other player!
Use this function:
damn, you're right... lol shit this is embarrassing
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)