28.12.2012, 07:51
Hi.I need if player is cop to can arrest player if he is a crime.But i wanna to can arrest it if the crime player is near by cop and if the crime isn't in vehicle.Sorry for my bad english
CMD:ar(playerid, params[])
{
if(!IsPlayerCop(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You are not a cop!"); //Player must be a cop to use this command
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new Float:pposx, Float:pposy, Float:pposz;
GetPlayerPos(playerid, pposx, pposy, pposz);
if(IsPlayerInRangeOfPoint(i, 5, pposx, pposy, pposz)) //If they are near the cop's position
{
if(GetPlayerWantedLevel(i) > 0) //If the player is wanted/a criminal
{
if(!IsPlayerInAnyVehicle(i)) //If they are not in a vehicle
{
//Arrest player
break;
}
}
}
}
}
return 1;
}