26.03.2011, 20:08
I want to create a command / pull which can only use the PD / FBI / SWAT to drag arrested (for example, have remained without a car and arrested the players and then you type the command and then you go boy this player follows you and you pull it) I made something and did not work, here's how I did
if anyone knows how to make this
pawn Код:
if(strcmp(cmd, "/pull", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gTeam[playerid] == 2 || IsACop(playerid))
{
if(KnockedDown[playerid] == 1)
{
SendClientMessage(playerid, COLOR_GREY, "That player is knockdown.");
return 1;
}
if(PlayerTied[playerid] == 1)
{
SendClientMessage(playerid, COLOR_GREY, " You tie!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "Comand: /pull [ID]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(gTeam[giveplayerid] == 2 || IsACop(giveplayerid))
{
SendClientMessage(playerid, COLOR_GREY, " can not drag a police officer!");
return 1;
}
if(PlayerCuffed[giveplayerid] != 2)
{
SendClientMessage(playerid, COLOR_GREY, " The players were handcuffed!");
return 1;
}
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You can not drag themselves!"); return 1; }
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s you pulling.", sendername);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
format(string, sizeof(string), "* Pulling %s-a.", giveplayer);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "* %s pull %s-a.", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " The player is not near you !");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Player is offline !");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Not a cop / FBI / SWAT !");
}
}
return 1;
}
if(strcmp(cmd, "/offpull", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gTeam[playerid] == 2)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "Comand: /offpull [ID]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You can not let ourselves!"); return 1; }
if(PlayerCuffed[giveplayerid])
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s you let.", sendername);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
format(string, sizeof(string), "* They let you %s-a.", giveplayer);
SendClientMessage(playerid, COLOR_WHITE, string);
TogglePlayerControllable(giveplayerid, 0);
}
else
{
SendClientMessage(playerid, COLOR_GREY, " How players are not handcuffed!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " The player is not near you !");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Player is offline !");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Not a cop / FBI / SWAT !");
}
}//not connected
return 1;
}