I found some script, trying to get it work:
Top:
Код:
new Dragged[MAX_PLAYERS];
new IsDragged[MAX_PLAYERS];
//Longer down at the public's
public Dragging(playerid,giveplayerid)
{
new Float:X1, Float:Y1, Float:Z1, Float:A1;
GetPlayerFacingAngle(playerid,A1);
GetPlayerPos(playerid,X1,Y1,Z1);
SetPlayerInterior(giveplayerid,GetPlayerInterior(playerid));
SetPlayerFacingAngle(giveplayerid,A1+180);
SetPlayerPos(giveplayerid,X1,Y1+2,Z1);
TogglePlayerControllable(giveplayerid,0);
return 1;
}
Command:
Код:
if (!strcmp(cmd, "/drag", true))
{
if(gTeam[playerid] == 2 || IsACop(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xFF0000AA, "/drag [playerid]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(!IsNumeric(tmp))
{
SendClientMessage(playerid,COLOR_RED, "/drag [playerid] Playerid must be a number!");
return 1;
}
if(IsPlayerConnected(giveplayerid))
{
if(GetDistanceBetweenPlayers(playerid,giveplayerid) > 3)
{
SendClientMessage(playerid, 0xFF0000AA, "You are too far away from that player.");
return 1;
}
if(giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_RED, "You cannot drag yourself!");
return 1;
}
if(Dragged[giveplayerid] == 0)
{
GetPlayerName(giveplayerid, sendername, sizeof(sendername));
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), "Officer %s started dragging %s", playername, sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
TogglePlayerControllable(giveplayerid,0);
Dragged[giveplayerid] = 1;
IsDragged[playerid] = SetTimerEx("Dragging", 1000, true, "i", giveplayerid);
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "This player is already being dragged");
}
}
else
{
format(string, sizeof(string), "%d is not an active player.", giveplayerid);
SendClientMessage(playerid,0xFF0000AA, string);
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are not a Cop / FBI / Marine !");
}
return 1;
}
This code kind of works, but when i try to drag, nothing happens. I and the player I wanted to drag get freezed. And if I unfreeze the other player I wanted to drag with admin command, he starts to drag me
Help!