29.01.2013, 18:30
I made a arrest cmd and i made it if 4-5 cops is on rangeofplayer and 1 cop arrest a criminals so they all cops cops get money and score too only who cops get it who on rangeof player point
there is my cmd:
there is my cmd:
Код:
CMD:ar(playerid, params[]) { new rangepass = 0, vehiclepass = 0, wantedpass = 0, dutypass = 0, eventpass = 0, arrestpass = 0; 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(i, 10.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), "Suspect %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", 3000, 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), "Suspect %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", 3000, 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), "Suspect %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", 3000, 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), "Suspect %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", 3000, 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); SendAdminMessage(GREY, astring); return true; }