SA-MP Forums Archive
AttackPlayerToPlayer? - 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: AttackPlayerToPlayer? (/showthread.php?tid=312559)



AttackPlayerToPlayer? - Gooday - 21.01.2012

I would like to make a command like /drag ID so a player can drag another one, all the RP/CnR servers got it but i dunno how to make :/

like at 3.13

[ame]http://www.youtube.com/watch?v=qSlwUxZPy8o&list=UUNQpN_dhA3HQLSWo2c1-Gig&index=4&feature=plcp[/ame]


+REP!


Re: AttackPlayerToPlayer? - LiamM - 21.01.2012

I guess you could create a timer that Gets the position of the player who used the command and then set the dragged players position to the new position of the cop..


Re: AttackPlayerToPlayer? - Gooday - 21.01.2012

so how?


Re: AttackPlayerToPlayer? - Jefff - 21.01.2012

You can use OnPlayerUpdate or timer if OnPlayerUpdate is too fast
pawn Код:
new Jailed[MAX_PLAYERS]={999,...};
connect/disconnect
pawn Код:
if(Jailed[playerid] != 999)
    Jailed[Jailed[playerid]] = 999;
Jailed[playerid] = 999;
in /drag id
pawn Код:
Jailed[giveplyerid] = playerid;
pawn Код:
public OnPlayerUpdate(playerid)
{
    if(Jailed[playerid] != 999)
    {
        new Float:P[4];
        GetPlayerPos(Jailed[playerid],P[0],P[1],P[2]);
        GetPlayerFacingAngle(Jailed[playerid],P[3]);
        P[0] -= (2.5 * floatsin(-P[3], degrees));
        P[1] -= (2.5 * floatcos(-P[3], degrees));
        SetPlayerPos(playerid,P[0],P[1],P[2]);
        SetPlayerFacingAngle(playerid,P[3]);
    }
    return 1;
}