28.06.2015, 10:36
PHP код:
CMD:arrest(playerid, params[])
{
new cName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME], targetid, string[128], string1[128];
if(gTeam[playerid] == CIVILIANS || gTeam[playerid] == MEDICS) return SendClientMessage(playerid, ROJOO, "Only Cops Can Arrest People");
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, RED, "You can't arrest players from a vehicle.");
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, ROJOO, "USAGE: /ar <playerid>");
if(targetid == playerid) return SendClientMessage(playerid, ROJOO, "You can't arrest yourself");
if(GetDistanceBetweenPlayers(playerid,targetid) > 10 && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(targetid))
{
GetPlayerName(playerid, cName, sizeof(cName));
GetPlayerName(targetid, tName, sizeof(tName));
if(IsPlayerConnected(targetid))
{
if(GetPlayerWantedLevel(targetid) >= 4)
{
if(HasBeenArrested{playerid} == false)
{
if(gTeam[playerid] == COPS)
{
new pay = random(1500) + 3000;
TogglePlayerControllable(targetid, false);
GameTextForPlayer(targetid, "~r~Arrested!", 3000, 5);
format(string1, sizeof(string1), "You have been arrested by %s (%d). You lose $%d", GetName(playerid), playerid, pay);
SendClientMessage(targetid, COLOR_CYAN, string1);
GameTextForPlayer(playerid,"~w~Suspect ~g~Arrested.",5000,5);
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
GivePlayerCashEx(playerid, pay);
GivePlayerCashEx(targetid, -pay);
pInfo[playerid][pArrest] ++;
pInfo[targetid][pBusted] ++;
ApplyAnimation(playerid, "ped", "ARRESTgun", 4.1, 0, 1, 1, 1, 1);
format(string, sizeof(string), "%s (%d) has been arrested by Cop %s (%d)!", GetName(targetid), targetid, GetName(playerid), playerid);
SendClientMessageToAll(COLOR_CYAN, string);
SetPlayerScore(targetid, GetPlayerScore(targetid) - 1);
SetPlayerScore(playerid, GetPlayerScore(targetid) + 1);
SetPlayerSpecialAction(targetid, SPECIAL_ACTION_HANDSUP);
SetTimerEx("SendPlayerToJail", 3000, false, "d", targetid);
HasBeenArrested{targetid} = true;
}
else if(gTeam[playerid] == CIA)
{
new pay = random(1500) + 3000;
TogglePlayerControllable(targetid, false);
GameTextForPlayer(targetid, "~r~Arrested!", 3000, 5);
format(string1, sizeof(string1), "You have been arrested by %s (%d). You lose $%d", GetName(playerid), playerid, pay);
SendClientMessage(targetid, COLOR_CYAN, string1);
GameTextForPlayer(playerid,"~w~Suspect ~g~Arrested.",5000,5);
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
GivePlayerCashEx(playerid, pay);
GivePlayerCashEx(targetid, -pay);
pInfo[playerid][pArrest] ++;
pInfo[targetid][pBusted] ++;
ApplyAnimation(playerid, "ped", "ARRESTgun", 4.1, 0, 1, 1, 1, 1);
format(string, sizeof(string), "%s (%d) has been arrested by an undercover CIA agent %s (%d)!", GetName(targetid), targetid, GetName(playerid), playerid);
SendClientMessageToAll(COLOR_CYAN, string);
SetPlayerScore(targetid, GetPlayerScore(targetid) - 1);
SetPlayerScore(playerid, GetPlayerScore(targetid) + 1);
SetPlayerSpecialAction(targetid, SPECIAL_ACTION_HANDSUP);
SetTimerEx("SendPlayerToJail", 3000, false, "d", targetid);
HasBeenArrested{targetid} = true;
}
else if(gTeam[playerid] == FBI)
{
new pay = random(1500) + 3000;
TogglePlayerControllable(targetid, false);
GameTextForPlayer(targetid, "~r~Arrested!", 3000, 5);
format(string1, sizeof(string1), "You have been arrested by %s (%d). You lose $%d", GetName(playerid), playerid, pay);
SendClientMessage(targetid, COLOR_CYAN, string1);
GameTextForPlayer(playerid,"~w~Suspect ~g~Arrested.",5000,5);
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
GivePlayerCashEx(playerid, pay);
GivePlayerCashEx(targetid, -pay);
pInfo[playerid][pArrest] ++;
pInfo[targetid][pBusted] ++;
ApplyAnimation(playerid, "ped", "ARRESTgun", 4.1, 0, 1, 1, 1, 1);
format(string, sizeof(string), "%s (%d) has been arrested by an FBI %s (%d)!", GetName(targetid), targetid, GetName(playerid), playerid);
SendClientMessageToAll(COLOR_CYAN, string);
SetPlayerScore(targetid, GetPlayerScore(targetid) - 1);
SetPlayerScore(playerid, GetPlayerScore(targetid) + 1);
SetPlayerSpecialAction(targetid, SPECIAL_ACTION_HANDSUP);
SetTimerEx("SendPlayerToJail", 3000, false, "d", targetid);
HasBeenArrested{targetid} = true;
}
else if(gTeam[playerid] == ARMY)
{
new pay = random(1500) + 3000;
TogglePlayerControllable(targetid, false);
GameTextForPlayer(targetid, "~r~Arrested!", 3000, 5);
format(string1, sizeof(string1), "You have been arrested by %s (%d). You lose $%d", GetName(playerid), playerid, pay);
SendClientMessage(targetid, COLOR_CYAN, string1);
GameTextForPlayer(playerid,"~w~Suspect ~g~Arrested.",5000,5);
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
GivePlayerCashEx(playerid, pay);
GivePlayerCashEx(targetid, -pay);
pInfo[playerid][pArrest] ++;
pInfo[targetid][pBusted] ++;
ApplyAnimation(playerid, "ped", "ARRESTgun", 4.1, 0, 1, 1, 1, 1);
format(string, sizeof(string), "%s (%d) has been arrested by an Army %s (%d)!", GetName(targetid), targetid, GetName(playerid), playerid);
SendClientMessageToAll(COLOR_CYAN, string);
SetPlayerScore(targetid, GetPlayerScore(targetid) - 1);
SetPlayerScore(playerid, GetPlayerScore(targetid) + 1);
SetPlayerSpecialAction(targetid, SPECIAL_ACTION_HANDSUP);
SetTimerEx("SendPlayerToJail", 3000, false, "d", targetid);
HasBeenArrested{targetid} = true;
}
}
}
else return SendClientMessage(playerid, RED, "There are no wanted players enough close.");
}
else return SendClientMessage(playerid, RED, "Invalid playerid.");
}
else SendClientMessage(playerid, RED, "There are no wanted players enough close.");
return 1;
}