23.09.2014, 12:57
Please stop bumping your thread.
Anyways,
I explained in the code.
Anyways,
pawn Код:
CMD:ar(playerid,params[]) // We are using ZCMD by Zeex
{
new string[128];
new ID;
if(sscanf(params, "u", ID)) // We are using sscanf so we define the command format usage
{
SendClientMessage(playerid,-1,"USAGE: /ar (Player Name/ID)");
return 1;
}
if(!IsPlayerConnected(ID)) // If the player is not connected, '!' refers to not
{
format(string,sizeof(string),"The player ID %d is not connected to the server. You cannot arrest them.",ID);
SendClientMessage(playerid,-1,string);
return 1;
}
if(GetDistanceBetweenPlayers(playerid,ID) > 4) // If the player distance between the id which he want to cuff is more than four
{
format(string,sizeof(string),"%s(%d) is too far away. You cannot reach him to arrest him.",PlayerName(ID),ID);
SendClientMessage(playerid,-1,string);
return 1;
}
if(playerid == ID) // If the id which he typed is the same as his id
{
SendClientMessage(playerid,-1,"You cannot arrest yourself, why would you do that anyway?");
return 1;
}
if(GetDistanceBetweenPlayers(playerid,ID) <= 4) // If the player is near from the police
{
// Sends a message to the player that he is arrested
SendClientMessage(ID,-1,"[[_Arrested_]]");
// Reseting player weapon so he wont shoot people while in jail
ResetPlayerWeapons(ID);
}
return 1;
}