I would to know how to script a /drag command which requires the victim to be cuffed. Also I want the victim to follow the officer that is dragging him without ability to go anywhere. Thanks in advance.
What is your variable for your cuffed? Also, what please show your command for /cuff.
pawn Код:
#include <a_samp>
new latencyT;
new Float:X,Float:Y,Float:Z;
new dragger;
new dragging[MAX_PLAYERS]=0;
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
forward GetDistanceBetweenPlayers(playerid,playerid2);
public GetDistanceBetweenPlayers(playerid,playerid2) //By Slick (Edited by Sacky)
{
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
new Float:tmpdis;
GetPlayerPos(playerid,x1,y1,z1);
GetPlayerPos(playerid2,x2,y2,z2);
tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
return floatround(tmpdis);
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(stopdrag,8,cmdtext);
dcmd(drag,4,cmdtext);
return 0;
}
dcmd_stopdrag(playerid,params[])
{
new pid1;
pid1=strval(params);
if(!strlen(params))
{
SendClientMessage(playerid, -1, "Usage: /stopdrag <playerid>");
}
else if (!IsPlayerConnected(pid1)) SendClientMessage(playerid, -1, "Invalid ID.");
else if (GetDistanceBetweenPlayers(playerid, pid1) > 5.00) SendClientMessage(playerid, -1, "The player that you have tried to drag him is away.");
else if (dragging[pid1]<1) SendClientMessage(playerid, -1, "* Bu oyuncu suruklenmiyor");
else{
dragging[pid1]=0;
TogglePlayerControllable(pid1,1);
KillTimer(latencyT);
}
dcmd_drag(playerid,params[])
{
new pid1;
pid1 = strval(params);
if(!strlen(params))
{
SendClientMessage(playerid, -1, "Usage: /drag <playerid>");
}
else if (!IsPlayerConnected(pid1)) SendClientMessage(playerid, -1, "Invalid ID.");
else if (GetDistanceBetweenPlayers(playerid, pid1) > 5.00) SendClientMessage(playerid, -1, "The player that you have tried to drag him is away.");
else
{
dragger=playerid;
latencyT=SetTimerEx("Drag", 1000, 1, "i", pid1);
dragging[pid1]=1;
TogglePlayerControllable(pid1,0);
}
return 1;
}
forward Drag(pid1);
public Drag(pid1)
{
GetPlayerPos(dragger,X,Y,Z);
SetPlayerPos(pid1,X,Y,Z);
return 1;
}