Try This;
PHP Code:
if(strcmp(cmd, "/drag", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(!IsACop(playerid))
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not a cop!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /drag [playerid/PartOfName]");
return 1;
}
if(PlayerInfo[playerid][pDBanned] == 1)
{
SendClientMessage(playerid, COLOR_GREY, "** You are Banned From Cop Duty!");
return 1;
}
new newcar = GetPlayerVehicleID(playerid);
new playa;
playa = ReturnUser(tmp);
if(IsACopCar(newcar) || IsNgCar(newcar) || IsAnFbiCar(newcar))
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playa,x,y,z);
if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z))
{
PutPlayerInVehicle(playa,newcar,1);
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* %s drags %s to his/her car/moped.", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
new y1, m, d;
new h,mi,s;
getdate(y1,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /drag %s",d,m,y1,h,mi,s,sendername,giveplayer);
CommandLog(string);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Player is not near you.");
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not in police vehicle!");
}
}
return 1;
}
Or This!
PHP Code:
CMD:drag(playerid, params[])
{
if(IsACop(playerid))
{
new string[128], giveplayerid;
if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /drag [playerid]");
if(IsPlayerConnected(giveplayerid))
{
if(GetPVarInt(giveplayerid, "PlayerCuffed") == 2)
{
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_WHITE, " You must be out of the vehicle to use this command.");
if(GetPVarInt(giveplayerid, "BeingDragged") == 1)
{
SendClientMessageEx(playerid, COLOR_WHITE, " That person is already being dragged. ");
return 1;
}
new Float:dX, Float:dY, Float:dZ;
GetPlayerPos(giveplayerid, dX, dY, dZ);
if(!IsPlayerInRangeOfPoint(playerid, 5.0, dX, dY, dZ))
{
SendClientMessageEx(playerid, COLOR_GRAD2, " That suspect is not near you.");
return 1;
}
format(string, sizeof(string), "* %s has is now dragging you.", GetPlayerNameEx(playerid));
SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
format(string, sizeof(string), "* You are now dragging %s, you may move them now.", GetPlayerNameEx(giveplayerid));
SendClientMessageEx(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "* %s grabs ahold of %s and begins to move them.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SendClientMessageEx(playerid, COLOR_WHITE, "You are now dragging the suspect, press the '{AA3333}FIRE{FFFFFF}' button to stop.");
SetPVarInt(giveplayerid, "BeingDragged", 1);
SetPVarInt(playerid, "DraggingPlayer", giveplayerid);
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, " The specified person is not cuffed !");
}
}
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, " You are not a LEO ! ");
return 1;
}
return 1;
}
Enjoy