20.11.2013, 12:16
pawn Код:
dcmd_arrest(playerid,params[])
{
if((gTeam[playerid] <= 5) && (gTeam[playerid] > 0))
{
if(CopDuty[playerid] == 1)
{
if(!strlen(params)) return SendClientMessage(playerid, RED, ":: Usage: /arrest [Player Id] ::");
new player1, playername[MAX_PLAYER_NAME], copname[MAX_PLAYER_NAME], string[128];
player1 = strval(params);
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
{
if(GetPlayerWantedLevel(player1) >= 1)
{
if(!IsPlayerInAnyVehicle(player1))
{
if(GetDistanceBetweenPlayers(playerid, player1) < 10)
{
GetPlayerName(player1, playername, sizeof(playername));
GetPlayerName(playerid, copname, sizeof(copname));
new jtime;
new reward;
reward = GetPlayerWantedLevel(player1);
jtime = GetPlayerWantedLevel(player1);
Info[player1][JailTime] = jtime*1000*60;
Info[player1][Jailed] = 1;
SetTimerEx("Jail1",1000,0,"d",player1);
SetTimerEx("JailPlayer",5000,0,"d",player1);
GivePlayerMoney(playerid, reward*1000);
SetPlayerWantedLevel(player1, 0);
SetPlayerScore(playerid, GetPlayerScore(playerid) +reward*5);
JailTimer[player1] = SetTimerEx("UnjailPlayer",Info[player1][JailTime],0,"d",player1);
format(string,sizeof(string),":: %s has arrested %s for %i minutes ::", copname, playername, jtime);
SendClientMessageToAll(COP_COLOR,string);
Info[playerid][Arrests]++;
new string2[256];
format(string2,sizeof(string2), ":: Congratulations, %s, you received $%i and %i score for arresting a %i-star wanted criminal! ::", copname, reward*1000, reward*5, reward);
return SendClientMessage(playerid, RED, string2);
}
else return SendClientMessage(playerid, RED, ":: ERROR: You need to be close to the player to arrest him ::");
}
else return SendClientMessage(playerid, RED, ":: ERROR: Player is in a vehicle ::");
}
else return SendClientMessage(playerid, RED, ":: ERROR: This player doesn't have 2+ stars, you can't arrest him ::");
}
else return SendClientMessage(playerid, RED, ":: ERROR: Player not found ::");
}
else return SendClientMessage(playerid, RED, ":: ERROR: You have to be on cop duty ::");
}
else return SendClientMessage(playerid, RED, ":: ERROR: You have to be a Cop to use this command ::");
}