09.10.2013, 00:48
pawn Код:
@Release(playerid);
@Release(playerid)
{
new Time = GetPVarInt(playerid, "JailTime");
if(!IsPlayerConnected(playerid))
return 0;
if(Time < 1)
return SpawnPlayer(playerid);
new str[30];
format(str, sizeof(str), "You will be released in: %d", Time);
GameTextForPlayer(playerid, str, 2500, 3); // Change it if you want
SetPVarInt(playerid, "JailTime", Time - 1); // Decrease the player's jail time
SetTimerEx("@Release", 1000, false, "i", playerid);
return 1;
}
CMD:ar(playerid,params[])
{
new
targetid;
if(gTeam[playerid] != Team_Cop)
{
SendClientMessage(playerid,COLOR_ERROR,"Only law enforcement can arrest wanted suspects.");
return 1;
}
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot arrest a suspect while in a vehicle. Exit the vehicle first.");
return 1;
}
if(sscanf(params, "u", targetid))
{
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /ar (Player Name/ID)");
return 1;
}
new
string[128];
if(targetid == INVALID_PLAYER_ID || !IsPlayerConnected(targetid))
{
format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot arrest them.",targetid);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(playerid == targetid)
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot arrest yourself, why would you do that anyway?");
return 1;
}
if(GetDistanceBetweenPlayers(playerid,targetid) > 4)
{
format(string,sizeof(string),"%s(%d) is too far away. You cannot reach him to arrest him.",GetName(targetid),targetid);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(GetPlayerState(targetid) == PLAYER_STATE_DRIVER || GetPlayerState(targetid) == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot arrest a suspect they are in a vehicle. Get them to exit the vehicle first.");
return 1;
}
if(GetPlayerWantedLevel(targetid) < 3)
{
format(string,sizeof(string),"%s(%d)'s wanted level is too low. You cannot jail them. Use /ticket (Player ID).",GetName(targetid),targetid);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(GetPVarInt(targetid, "Cuffed") == 0)
{
format(string,sizeof(string),"%s(%d) is not cuffed. You have to place the suspect in cuffs before attempted to arrest them.",GetName(targetid),targetid);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
GivePlayerMoney(playerid, 3000);
IncreaseScore(playerid, 1);
IncreaseCoprank(playerid, 1);
SetPVarInt(targetid, "JailTime", 45);
SetPlayerInterior(targetid, 10);
new rnd = random(sizeof(PrisonSpawn));
SetPlayerPos(targetid, PrisonSpawn[rnd][0], PrisonSpawn[rnd][1], PrisonSpawn[rnd][2]);
SendClientMessage(targetid, COLOR_GREY, "**LOS SANTOS PRISON**");
SendClientMessage(targetid, COLOR_LIGHTBLUE, "[PRISON] You have been sent to prison. You will be released soon.");
TogglePlayerControllable(targetid, 1);
SetPlayerWantedLevel(targetid, 0);
@Release(targetid);
return 1;
}