How to make if 3 cops going to arrest one criminal and ofc one cop will do /arrest id and they will get 1 score and money for arrest
i want one cop will arrest one criminal but they give score and money to 3 cops.
Well ... and how exactly you're planning to do that? I mean, you want a command for a cop (the cop that arrests the player) to choose the other 2 cops or ?
my point is, i want me and you going to arresting criminals and we saw a criminal on foot so i will do /ar and arrest criminal and i get 1 score and money for arresting but i want they gave score money you too.
who is on rangepoint so they gave score and money for all cops who is on rangepoint.
He actually means, when ''I'' arrest a player then the other player (sscarface) gets +1 score too. The +1 score is for the assist within a range of 10 metres for example + the cop who arrested the criminal gets money for it, and the other cops who where in the range of 10 metres too, they get the half of what the cop got for arresting the criminal (assists money).
Simple. Just when you execute the arrest command, before putting the targetid in jail, GetPlayerPos(criminal). Then, for(new i;i<Max_players;i++) isplayerinrangeofpoint(10 metres and the criminals position..) if yes, give him the required money..also, add the condition, if(i==playerid), continue; since you will be giving the money OUT of the loop.
I don't understand sorry, CAn you make it with my cmd. thanks.
PHP код:
CMD:ar(playerid, params[])
{
new rangepass = 0, vehiclepass = 0, wantedpass = 0, dutypass = 0, eventpass = 0, arrestpass = 0;
if((gettime() - 5) < TimerInfo[playerid][CMD_timer30]) return SendClientMessage(playerid, RED, "Please wait before using this command again.");
if(GetTeam{playerid} == CLASS_CIV || GetTeam{playerid} == CLASS_MEDIC) return SendClientMessage(playerid, RED, "Only law enforcement can arrest players.");
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, RED, "You cant arrest players from a vehicle.");
foreach(Player, i)
{
if(i == playerid) continue;
new Float:x, Float:y, Float:z;
GetPlayerPos(i, x, y, z);
new Float:hp;
GetPlayerHealth(i, hp);
if(hp > 0.0)
if(IsPlayerInRangeOfPoint(playerid, 7.0, x, y, z) && GetPlayerInterior(playerid) == GetPlayerInterior(i) && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
{
rangepass++;
if(GetPlayerWantedLevel(i) >= 4)
{
wantedpass++;
if(!IsPlayerInAnyVehicle(i))
{
vehiclepass++;
if(IsOnduty{i} == 0)
{
dutypass++;
if(IsAtEvent{i} == 0)
{
eventpass++;
if(HasBeenArrested{i} == false)
{
arrestpass++;
if(GetTeam{playerid} == CLASS_COPS)
{
PlayerInfo[i][pArrests] ++;
TogglePlayerControllable(i, false);
GameTextForPlayer(i, "~r~Arrested!", 3000, 5);
format(fstr, sizeof(fstr), "Officer %s (%d) has just arrested you.", GetName(playerid), playerid);
SendClientMessage(i, COLOR_AQUA, fstr);
GameTextForPlayer(playerid,"~w~Suspect ~g~Arrested.",5000,5);
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
new pay = random(10000) + 5000;
GivePlayerCash(playerid, pay);
PlayerInfo[playerid][pTakedowns] ++;
ApplyAnimation(playerid, "ped", "ARRESTgun", 4.1, 0, 1, 1, 1, 1);
format(fstr2, sizeof(fstr2), "%s (%d) has been arrested by Officer %s (%d)", GetName(i), i, GetName(playerid), playerid);
SendClientMessageToAll(COLOR_AQUA, fstr2);
SetPlayerScore(i, GetPlayerScore(i) - 1);
SetPlayerSpecialAction(i, SPECIAL_ACTION_HANDSUP);
SetTimerEx("SendPlayerToJail", 2000, false, "d", i);
HasBeenArrested{i} = true;
break;
}
else if(GetTeam{playerid} == CLASS_CIA)
{
PlayerInfo[i][pArrests] ++;
TogglePlayerControllable(i, false);
GameTextForPlayer(i, "~r~Arrested!", 3000, 5);
SendClientMessage(i, COLOR_AQUA, "You have been arrested by a Undercover CIA Agent.");
GameTextForPlayer(playerid,"~w~Suspect ~g~Arrested.",5000,5);
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
new pay = random(10000) + 5000;
GivePlayerCash(playerid, pay);
PlayerInfo[playerid][pTakedowns] ++;
ApplyAnimation(playerid, "ped", "ARRESTgun", 4.1, 0, 1, 1, 1, 1);
format(fstr, sizeof(fstr), "%s (%d) has been arrested by a Undercover CIA Agent.", GetName(i), i);
SendClientMessageToAll(COLOR_AQUA, fstr);
SetPlayerScore(i, GetPlayerScore(i) - 1);
SetPlayerSpecialAction(i, SPECIAL_ACTION_HANDSUP);
SetTimerEx("SendPlayerToJail", 2000, false, "d", i);
HasBeenArrested{i} = true;
break;
}
else if(GetTeam{playerid} == CLASS_FBI)
{
PlayerInfo[i][pArrests] ++;
TogglePlayerControllable(i, false);
GameTextForPlayer(i, "~r~Arrested!", 3000, 5);
SendClientMessage(i, COLOR_AQUA, "You have been arrested by a Undercover FBI Agent.");
GameTextForPlayer(playerid,"~w~Suspect ~g~Arrested.",5000,5);
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
new pay = random(10000) + 5000;
GivePlayerCash(playerid, pay);
PlayerInfo[playerid][pTakedowns] ++;
ApplyAnimation(playerid, "ped", "ARRESTgun", 4.1, 0, 1, 1, 1, 1);
format(fstr, sizeof(fstr), "%s (%d) has been arrested by a Undercover FBI Agent.", GetName(i), i);
SendClientMessageToAll(COLOR_AQUA, fstr);
SetPlayerScore(i, GetPlayerScore(i) - 1);
SetPlayerSpecialAction(i, SPECIAL_ACTION_HANDSUP);
SetTimerEx("SendPlayerToJail", 2000, false, "d", i);
HasBeenArrested{i} = true;
break;
}
else if(GetTeam{playerid} == CLASS_ARMY)
{
PlayerInfo[i][pArrests] ++;
TogglePlayerControllable(i, false);
GameTextForPlayer(i, "~r~Arrested!", 3000, 5);
SendClientMessage(i, COLOR_AQUA, "You have been arrested by a Army Soldier.");
GameTextForPlayer(playerid,"~w~Suspect ~g~Arrested.",5000,5);
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
new pay = random(10000) + 5000;
GivePlayerCash(playerid, pay);
PlayerInfo[playerid][pTakedowns] ++;
ApplyAnimation(playerid, "ped", "ARRESTgun", 4.1, 0, 1, 1, 1, 1);
format(fstr, sizeof(fstr), "%s (%d) has been arrested by a Army Soldier.", GetName(i), i);
SendClientMessageToAll(COLOR_AQUA, fstr);
SetPlayerScore(i, GetPlayerScore(i) - 1);
SetPlayerSpecialAction(i, SPECIAL_ACTION_HANDSUP);
SetTimerEx("SendPlayerToJail", 2000, false, "d", i);
HasBeenArrested{i} = true;
break;
}
}
}
}
}
}
}
}
if(rangepass == 0)
{
SendClientMessage(playerid, RED, "No wanted players in range.");
}
else if(wantedpass == 0)
{
SendClientMessage(playerid, RED, "No wanted players in range.");
}
else if(vehiclepass == 0)
{
SendClientMessage(playerid, RED, "No wanted players in range.");
}
else if(dutypass == 0)
{
SendClientMessage(playerid, RED, "No wanted players in range.");
}
else if(eventpass == 0)
{
SendClientMessage(playerid, RED, "No wanted players in range.");
}
else if(arrestpass == 0)
{
SendClientMessage(playerid, RED, "No wanted players in range.");
}
new astring[100];
format(astring, sizeof(astring),"%s (%d) typed: /ar", GetName(playerid), playerid);
SendAdmin1Message(GREY, astring);
return true;
}