dcmd_cuff(playerid,params[]) { new string[128]; new ID; if(sscanf(params, "u", ID)) { SendClientMessage(playerid,COLOR_ERROR,"USAGE: /cuff (Player Name/ID)"); return 1; } if(IsSpawned[playerid] != 1) { SendClientMessage(playerid,COLOR_ERROR,"You must be alive and spawned in order to be able to use this command."); return 1; } if(gTeam[playerid] != COP && gTeam[playerid] != SWAT && gTeam[playerid] != FBI && gTeam[playerid] != ARMY) { SendClientMessage(playerid,COLOR_ERROR,"Only law enforcement can place cuffs on suspects."); return 1; } if(!IsPlayerConnected(ID)) { format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot cuff them",ID); SendClientMessage(playerid,COLOR_ERROR,string); return 1; } if(GetDistanceBetweenPlayers(playerid,ID) > 4) { format(string,sizeof(string),"%s(%d) is too far away. You cannot reach him to place cuffs on him.",PlayerName(ID),ID); SendClientMessage(playerid,COLOR_ERROR,string); return 1; } if(gTeam[ID] == COP || gTeam[ID] == SWAT || gTeam[ID] == FBI || gTeam[ID] == ARMY) { SendClientMessage(playerid,COLOR_ERROR,"You cannot place other Law Enforcement officer in cuffs. You might lose your job for that .."); return 1; } if(IsCuffed[ID] == 1) { format(string,sizeof(string),"%s(%d) is already cuffed. You don't want to waste a second pair of cuffs on them.",PlayerName(ID),ID); SendClientMessage(playerid,COLOR_ERROR,string); return 1; } if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) { SendClientMessage(playerid,COLOR_ERROR,"You cannot place a suspect in cuffs while in a vehicle. Exit the vehicle first."); return 1; } if(GetPlayerState(ID) == PLAYER_STATE_DRIVER || GetPlayerState(ID) == PLAYER_STATE_PASSENGER) { SendClientMessage(playerid,COLOR_ERROR,"You cannot place a suspect in cuffs while they are in a vehicle. Get them to exit the vehicle first."); return 1; } if(playerid == ID) { SendClientMessage(playerid,COLOR_ERROR,"You cannot put cuffs on yourself, it wouldn't be a good idea with rapists around."); return 1; } if(IsSpawned[ID] != 1) { format(string,sizeof(string),"%s(%d) is not spawned. You cannot place cuffs on dead people ..",PlayerName(ID),ID); SendClientMessage(playerid,COLOR_ERROR,string); return 1; } if(GetDistanceBetweenPlayers(playerid,ID) <= 4) { SendClientMessage(playerid,COLOR_WHITE,"[[_Suspect Cuffed_]]"); format(string,sizeof(string),"You have placed cuffs on %s(%d)! They can no longer move.",PlayerName(ID),ID); SendClientMessage(playerid,COLOR_LIGHTBLUE,string) ; SendClientMessage(ID,COLOR_LIGHTBLUE,"[[_Placed in handcuffs_]]"); format(string,sizeof(string),"Law enforcement officer %s(%d) has placed you in handcuffs!",PlayerName(playerid),playerid); SendClientMessage(ID,COLOR_LIGHTBLUE,string); TogglePlayerControllable(ID,0); ApplyAnimation(ID, "ped", "cower", 3.0, 1, 0, 0, 0, 0); // Taking Cover IsCuffed[ID] =1; return 1; } return 1; } |
dcmd_cuff(playerid,params[])
{
new string[128];
new ID;
if(sscanf(params, "u", ID))
{
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /cuff (Player Name/ID)");
return 1;
}
if(IsSpawned[playerid] != 1)//this checks if the player is spawned
{
SendClientMessage(playerid,COLOR_ERROR,"You must be alive and spawned in order to be able to use this command.");
return 1;
}
if(gTeam[playerid] != COP && gTeam[playerid] != SWAT && gTeam[playerid] != FBI && gTeam[playerid] != ARMY)// this checks which team the person trying to use the command is in
{
SendClientMessage(playerid,COLOR_ERROR,"Only law enforcement can place cuffs on suspects.");
return 1;
}
if(!IsPlayerConnected(ID))// this checks if the player the officer trying to cuff is connected or not
{
format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot cuff them",ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(GetDistanceBetweenPlayers(playerid,ID) > 4) // gets the the distance between the oficer and the suspect
{
format(string,sizeof(string),"%s(%d) is too far away. You cannot reach him to place cuffs on him.",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(gTeam[ID] == COP || gTeam[ID] == SWAT || gTeam[ID] == FBI || gTeam[ID] == ARMY)// check the team of the person who is trying to use /cuff
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot place other Law Enforcement officer in cuffs. You might lose your job for that ..");
return 1;
}
if(IsCuffed[ID] == 1)// checks if the suspect is already cuffed
{
format(string,sizeof(string),"%s(%d) is already cuffed. You don't want to waste a second pair of cuffs on them.",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)// checks if the officer is in a passenger seat or in any vehicle
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot place a suspect in cuffs while in a vehicle. Exit the vehicle first.");
return 1;
}
if(GetPlayerState(ID) == PLAYER_STATE_DRIVER || GetPlayerState(ID) == PLAYER_STATE_PASSENGER)// checks if the suspect is in a passenger seat or in any vehicle
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot place a suspect in cuffs while they are in a vehicle. Get them to exit the vehicle first.");
return 1;
}
if(playerid == ID)// checks if the officer trying to /cuff themself
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot put cuffs on yourself, it wouldn't be a good idea with rapists around.");
return 1;
}
if(IsSpawned[ID] != 1)// checks if the suspect is spawned
{
format(string,sizeof(string),"%s(%d) is not spawned. You cannot place cuffs on dead people ..",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(GetDistanceBetweenPlayers(playerid,ID) <= 4)// checks if the officer is close to the suspect then the code below will be executed(hence the suspect will be cuffed)
{
SendClientMessage(playerid,COLOR_WHITE,"[[_Suspect Cuffed_]]");
format(string,sizeof(string),"You have placed cuffs on %s(%d)! They can no longer move.",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string) ;
SendClientMessage(ID,COLOR_LIGHTBLUE,"[[_Placed in handcuffs_]]");
format(string,sizeof(string),"Law enforcement officer %s(%d) has placed you in handcuffs!",PlayerName(playerid),playerid);
SendClientMessage(ID,COLOR_LIGHTBLUE,string);
TogglePlayerControllable(ID,0);
ApplyAnimation(ID, "ped", "cower", 3.0, 1, 0, 0, 0, 0); // Taking Cover
IsCuffed[ID] =1;
return 1;
}
return 1;
}
if(IsSpawned[ID] != 1) |
new ID;
if(sscanf(params, "u", ID))
{
...