SA-MP Forums Archive
Position behind another player - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Position behind another player (/showthread.php?tid=469300)



Position behind another player - ajwar - 12.10.2013

How to create a function that should set a player behind me? Like SetPlayerPos1(playerid, behindid);


Re: Position behind another player - Pottus - 12.10.2013

pawn Код:
stock GetPosBehindPlayer(playerid, Float:distance, &Float:px, &Float:py, &Float:pz,)
{
    GetPlayerPos(playerid, px, py, pz);
    GetPlayerFacingAngle(playerid, pfa);
    px -= (distance * floatsin(-pfa, degrees));
    py -= (distance * floatcos(-pfa, degrees));
    return 1;
}



Re: Position behind another player - xVIP3Rx - 12.10.2013

pawn Код:
stock SetPlayerBehindPlayer(playerid, Player2)
{
    new Float:X, Float:Y, Float:Z, Float:A;
    GetPlayerPos(playerid, X, Y, Z);
    GetPlayerFacingAngle(playerid, A);
    SetPlayerPos(Player2, X, Y+5, Z);
    SetPlayerFacingAngle(Player2, A);
        return 1;
}
Try this..