SA-MP Forums Archive
Attach player to 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: Attach player to another player (/showthread.php?tid=542372)



Attach player to another player - Anuris - 18.10.2014

Hello.

Guys, is that possible to attach one player to another one?
I mean, one player moves and another one do the same move.

Sorry for my English.


Re: Attach player to another player - Abagail - 18.10.2014

This?

pawn Код:
stock AttachPlayerToPlayer(playerid, giveplayerid, Float: behind = 2.0)
{
     new Float: pos[3];
     GetPlayerPos(giveplayerid, pos[0], pos[1], pos[2]);
     SetPlayerPos(playerid, pos[0]-behind, pos[1], pos[2]);
     UpdateTimer[playerid] = SetTimerEx("AttachUpdate", 1000, true, "iif", playerid, giveplayerid, behind);
     Attached[playerid] = true;
}

stock DetachPlayer(playerid)
{
  KillTimer(UpdateTimer[playerid]);
  Attached[playerid] = false;
  return true;
}

public AttachUpdate(playerid, giveplayerid, Float: behind = 2.0)
{
    new Float: pos[3];
    GetPlayerPos(giveplayerid, pos[0], pos[1], pos[2]);
    SetPlayerPos(playerid, pos[0]-behind, pos[1], pos[2]);
    return true;
}