15.07.2010, 15:30
Hey guys. I have a drag command but I want it only work if the cop is near the player:
thanks in advance
pawn Код:
if (strcmp(cmd, "/drag", true) == 0)
{
new giveplayerid = strval(tmp);
if(sapd[playerid] >=1)
{
tmp = strtok(cmdtext, idx);
giveplayerid = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_RED, "USAGE: /drag [playerid]");
return 1;
}
if(!IsPlayerConnected(giveplayerid))
{
format(string, sizeof(string), "%d is not an active player.", giveplayerid);
SendClientMessage(playerid,COLOR_RED, string);
return 1;
}
if(giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_RED, "You cannot drag yourself!");
return 1;
}
if(DragTimer[playerid] <= 0)
{
if(IsPlayerConnected(giveplayerid) == 1)
{
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_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED);
DragTimer[playerid] = SetTimerEx("Drag", 1000, 1, "ii", playerid, giveplayerid);
TogglePlayerControllable(giveplayerid, 0);
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, " You are not a Cop / FBI / Marine !");
}
return 1;
}