25.07.2012, 17:23
pawn Code:
CMD:arrest(playerid, params[])
{
if(IsACop(playerid) || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pDivision] == 2 || PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pRank] >= 5 || (PlayerInfo[playerid][pMember] == 12 && PlayerInfo[playerid][pDivision] == 2))
{
if(!IsAtArrestPoint(playerid))
{// Jail spot
SendClientMessageEx(playerid, COLOR_GREY, "You aren't at the arrest point.");
return 1;
}
new string[128], moneys, time, bail, bailprice;
if(sscanf(params, "dddd", moneys, time, bail, bailprice)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /arrest [price] [time (minutes)] [bail (0=no 1=yes)] [bailprice]");
if(moneys < 1 || moneys > 30000) { SendClientMessageEx(playerid, COLOR_GREY, "The jail price can't be below $1 or above $30,000."); return 1; }
if(time < 1 || time > 30) { SendClientMessageEx(playerid, COLOR_GREY, "Jail time can't be below 1 or above 30 minutes - take the person to prison for more time."); return 1; }
if(bail < 0 || bail > 1) { SendClientMessageEx(playerid, COLOR_GREY, "The bail option must be set to 0 or 1."); return 1; }
if(bailprice < 0 || bailprice > 10000) { SendClientMessageEx(playerid, COLOR_GREY, "The bail price can't be below $0 or above $10,000."); return 1; }
new suspect = GetClosestPlayer(playerid);
if(IsPlayerConnected(suspect))
{
if(ProxDetectorS(5.0, playerid,suspect))
{
if(PlayerInfo[suspect][pWantedLevel] < 1 && PlayerInfo[playerid][pMember] != 12)
{
SendClientMessageEx(playerid, COLOR_GREY, "The player must have a wanted level of at least one star.");
return 1;
}
new giveplayerid;
format(string, sizeof(string), "* You arrested %s!", GetPlayerNameEx(suspect));
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
GivePlayerCash(suspect, -moneys);
Tax += moneys;
ResetPlayerWeaponsEx(suspect);
SetPlayerSpecialAction(giveplayerid,SPECIAL_ACTION_NONE);
RemovePlayerAttachedObject(giveplayerid,0);
if(PlayerVehicleInfo[suspect][0][pvTicket] != 0)
{
PlayerVehicleInfo[suspect][0][pvTicket] = 0;
}
if(PlayerVehicleInfo[suspect][1][pvTicket] != 0)
{
PlayerVehicleInfo[suspect][1][pvTicket] = 0;
}
if(PlayerVehicleInfo[suspect][2][pvTicket] != 0)
{
PlayerVehicleInfo[suspect][2][pvTicket] = 0;
}
if(PlayerVehicleInfo[suspect][3][pvTicket] != 0)
{
PlayerVehicleInfo[suspect][3][pvTicket] = 0;
}
if(PlayerVehicleInfo[suspect][4][pvTicket] != 0)
{
PlayerVehicleInfo[suspect][4][pvTicket] = 0;
}
//TogglePlayerControllable(suspect, 1);
if(IsPlayerInRangeOfPoint(playerid, 4.0, -800.397094, -1877.925903, 11.668975) || IsPlayerInRangeOfPoint(playerid, 3.0,1528.4888,-1677.7632,5.8906) || IsPlayerInRangeOfPoint(playerid, 3.0,1566.4901,-1653.9076,28.3956) || IsPlayerInRangeOfPoint(playerid,4.0,680.2208,-1546.9856,14.8516) || PlayerInfo[playerid][pVW] == 133337)
{
//format(string, sizeof(string), "<< Officer %s arrested suspect %s >>", GetPlayerNameEx(playerid), GetPlayerNameEx(suspect));
//OOCNews(COLOR_LIGHTRED, string);
SetPlayerInterior(suspect, 10);
new rand = random(sizeof(LSPDJail));
SetPlayerFacingAngle(suspect, 0);
SetPlayerPos(suspect, LSPDJail[rand][0], LSPDJail[rand][1], LSPDJail[rand][2]);
if(PlayerInfo[suspect][pDonateRank] >= 2)
{
PlayerInfo[suspect][pJailTime] = ((time*60)*75)/100;
}
else
{
PlayerInfo[suspect][pJailTime] = time * 60;
}
DeletePVar(suspect, "IsFrozen");
//Frozen[suspect] = 0;
PlayerInfo[suspect][pJailed] = 1;
PhoneOnline[suspect] = 1;
PlayerInfo[suspect][pArrested] += 1;
SetPlayerFree(suspect,playerid, "was arrested");
WantedPoints[suspect] = 0;
PlayerInfo[suspect][pWantedLevel] = 0;
SetPlayerToTeamColor(suspect);
SetPlayerWantedLevel(suspect, 0);
WantLawyer[suspect] = 1;
TogglePlayerControllable(suspect, 1);
ClearAnimations(suspect);
PlayerCuffed[suspect] = 0;
DeletePVar(suspect, "PlayerCuffed");
PlayerCuffedTime[suspect] = 0;
PlayerInfo[suspect][pVW] = 133337;
SetPlayerVirtualWorld(suspect, 133337);
SetPlayerSpecialAction(giveplayerid,SPECIAL_ACTION_NONE);
RemovePlayerAttachedObject(giveplayerid,0);
}
else if(PlayerInfo[playerid][pMember] == 11) {
TogglePlayerControllable(suspect, 0);
GameTextForPlayer(suspect, "Objects loading...", 4000, 5);
SetPVarInt(suspect, "LoadingObjects", 1);
SetTimerEx("SafeLoadObjects", 4000, 0, "d", suspect);
SetPlayerInterior(suspect, 1);
PlayerInfo[suspect][pInt] = 1;
SetPlayerVirtualWorld(suspect, 0);
PlayerInfo[suspect][pVW] = 0;
if(PlayerInfo[suspect][pDonateRank] >= 2)
{
PlayerInfo[suspect][pJailTime] = ((time*60)*75)/100;
}
else
{
PlayerInfo[suspect][pJailTime] = time * 60;
}
PlayerInfo[suspect][pJailed] = 2;
PhoneOnline[suspect] = 1;
DeletePVar(suspect, "IsFrozen");
PlayerInfo[suspect][pArrested] += 1;
SetPlayerFree(suspect,playerid, "was arrested");
WantedPoints[suspect] = 0;
PlayerInfo[suspect][pWantedLevel] = 0;
SetPlayerToTeamColor(suspect);
SetPlayerWantedLevel(suspect, 0);
TogglePlayerControllable(suspect, 1);
ClearAnimations(suspect);
PlayerCuffed[suspect] = 0;
DeletePVar(suspect, "PlayerCuffed");
PlayerCuffedTime[suspect] = 0;
new rand = random(sizeof(ICPrisonSpawns));
Streamer_UpdateEx(suspect, ICPrisonSpawns[rand][0], ICPrisonSpawns[rand][1], ICPrisonSpawns[rand][2]);
SetPlayerPos(suspect, ICPrisonSpawns[rand][0], ICPrisonSpawns[rand][1], ICPrisonSpawns[rand][2]);
ResetPlayerWeaponsEx(suspect);
}
else if(PlayerInfo[playerid][pMember]==2||PlayerInfo[playerid][pLeader]==2)
{
//format(string, sizeof(string), "<< FBI Agent %s arrested suspect %s >>", sendername, giveplayer);
//OOCNews(COLOR_LIGHTRED, string);
TogglePlayerControllable(suspect, 0);
GameTextForPlayer(suspect, "Objects loading...", 4000, 5);
SetPVarInt(suspect, "LoadingObjects", 1);
SetTimerEx("SafeLoadObjects", 4000, 0, "d", suspect);
SetPlayerInterior(suspect, 1);
PlayerInfo[suspect][pVW] = 1324123;
PlayerInfo[suspect][pInt] = 1;
SetPlayerVirtualWorld(suspect, 1324123);
SetPlayerPos(suspect,315.1677,-1451.5564,-33.5292);
if(PlayerInfo[suspect][pDonateRank] >= 2)
{
PlayerInfo[suspect][pJailTime] = ((time*60)*75)/100;
}
else
{
PlayerInfo[suspect][pJailTime] = time * 60;
}
PlayerInfo[suspect][pJailed] = 3;
PhoneOnline[suspect] = 1;
DeletePVar(suspect, "IsFrozen");
//Frozen[suspect] = 0;
PlayerInfo[suspect][pArrested] += 1;
SetPlayerFree(suspect,playerid, "was arrested");
WantedPoints[suspect] = 0;
PlayerInfo[suspect][pWantedLevel] = 0;
SetPlayerToTeamColor(suspect);
SetPlayerWantedLevel(suspect, 0);
WantLawyer[suspect] = 1;
TogglePlayerControllable(suspect, 1);
ClearAnimations(suspect);
PlayerCuffed[suspect] = 0;
DeletePVar(suspect, "PlayerCuffed");
PlayerCuffedTime[suspect] = 0;
SetPlayerSpecialAction(giveplayerid,SPECIAL_ACTION_NONE);
RemovePlayerAttachedObject(giveplayerid,0);
}
else if(PlayerInfo[playerid][pMember]==3||PlayerInfo[playerid][pLeader]==3)
{
//format(string, sizeof(string), "<< Deputy %s arrested suspect %s >>", sendername, giveplayer);
//OOCNews(COLOR_LIGHTRED, string);
SetPlayerInterior(suspect, 3);
SetPlayerPos(suspect,198.1944,175.9581,1003.0234);
if(PlayerInfo[suspect][pDonateRank] >= 2)
{
PlayerInfo[suspect][pJailTime] = ((time*60)*75)/100;
}
else
{
PlayerInfo[suspect][pJailTime] = time * 60;
}
DeletePVar(suspect, "IsFrozen");
//Frozen[suspect] = 0;
PlayerInfo[suspect][pJailed] = 8;
PhoneOnline[suspect] = 1;
PlayerInfo[suspect][pArrested] += 1;
SetPlayerFree(suspect,playerid, "was arrested");
WantedPoints[suspect] = 0;
PlayerInfo[suspect][pWantedLevel] = 0;
SetPlayerToTeamColor(suspect);
SetPlayerWantedLevel(suspect, 0);
WantLawyer[suspect] = 1;
TogglePlayerControllable(suspect, 1);
ClearAnimations(suspect);
PlayerCuffed[suspect] = 0;
DeletePVar(suspect, "PlayerCuffed");
PlayerCuffedTime[suspect] = 0;
PlayerInfo[suspect][pVW] = 0;
SetPlayerVirtualWorld(suspect, 0);
SetPlayerSpecialAction(giveplayerid,SPECIAL_ACTION_NONE);
RemovePlayerAttachedObject(giveplayerid,0);
}
else if(PlayerInfo[playerid][pMember]==7||PlayerInfo[playerid][pLeader]==7)
{
//format(string, sizeof(string), "<< Deputy %s arrested suspect %s >>", sendername, giveplayer);
//OOCNews(COLOR_LIGHTRED, string);
TogglePlayerControllable(suspect, 0);
GameTextForPlayer(suspect, "Objects loading...", 4000, 5);
SetPVarInt(suspect, "LoadingObjects", 1);
SetTimerEx("SafeLoadObjects", 4000, 0, "d", suspect);
SetPlayerPos(suspect,2500.3296,-1679.2875,562.7988);
if(PlayerInfo[suspect][pDonateRank] >= 2)
{
PlayerInfo[suspect][pJailTime] = ((time*60)*75)/100;
}
else
{
PlayerInfo[suspect][pJailTime] = time * 60;
}
DeletePVar(suspect, "IsFrozen");
//Frozen[suspect] = 0;
PlayerInfo[suspect][pJailed] = 7;
PhoneOnline[suspect] = 1;
PlayerInfo[suspect][pArrested] += 1;
SetPlayerFree(suspect,playerid, "was arrested");
WantedPoints[suspect] = 0;
PlayerInfo[suspect][pWantedLevel] = 0;
SetPlayerToTeamColor(suspect);
SetPlayerWantedLevel(suspect, 0);
WantLawyer[suspect] = 1;
TogglePlayerControllable(suspect, 1);
ClearAnimations(suspect);
PlayerCuffed[suspect] = 0;
DeletePVar(suspect, "PlayerCuffed");
PlayerCuffedTime[suspect] = 0;
PlayerInfo[suspect][pVW] = 1699;
SetPlayerVirtualWorld(suspect, 1699);
SetPlayerSpecialAction(giveplayerid,SPECIAL_ACTION_NONE);
RemovePlayerAttachedObject(giveplayerid,0);
}
else if(PlayerInfo[playerid][pMember]==12||PlayerInfo[playerid][pLeader]==12)
{
TogglePlayerControllable(suspect, 0);
if(PlayerInfo[suspect][pDonateRank] >= 2)
{
PlayerInfo[suspect][pJailTime] = ((time*60)*75)/100;
}
else
{
PlayerInfo[suspect][pJailTime] = time * 60;
}
DeletePVar(suspect, "IsFrozen");
//Frozen[suspect] = 0;
PlayerInfo[suspect][pJailed] = 9;
PhoneOnline[suspect] = 1;
PlayerInfo[suspect][pWantedLevel] = 0;
SetPlayerToTeamColor(suspect);
WantLawyer[suspect] = 1;
TogglePlayerControllable(suspect, 1);
ClearAnimations(suspect);
PlayerCuffed[suspect] = 0;
DeletePVar(suspect, "PlayerCuffed");
PlayerCuffedTime[suspect] = 0;
SetPlayerInterior(suspect, 5);
PlayerInfo[suspect][pInt] = 5;
PlayerInfo[suspect][pVW] = 99;
SetPlayerVirtualWorld(suspect, 99);
SetPlayerPos(suspect, 319.554931, 312.155181, 999.148437);
SetPlayerSpecialAction(giveplayerid,SPECIAL_ACTION_NONE);
RemovePlayerAttachedObject(giveplayerid,0);
}
else if(PlayerInfo[playerid][pMember]==1||PlayerInfo[playerid][pLeader]==1)
{
new rand = random(sizeof(LSPDJail));
TogglePlayerControllable(suspect, 0);
GameTextForPlayer(suspect, "Objects loading...", 4000, 5);
SetPVarInt(suspect, "LoadingObjects", 1);
SetTimerEx("SafeLoadObjects", 4000, 0, "d", suspect);
SetPlayerPos(suspect, LSPDJail[rand][0], LSPDJail[rand][1], LSPDJail[rand][2]);
if(PlayerInfo[suspect][pDonateRank] >= 2)
{
PlayerInfo[suspect][pJailTime] = ((time*60)*75)/100;
}
else
{
PlayerInfo[suspect][pJailTime] = time * 60;
}
DeletePVar(suspect, "IsFrozen");
//Frozen[suspect] = 0;
PlayerInfo[suspect][pJailed] = 1;
PhoneOnline[suspect] = 1;
PlayerInfo[suspect][pArrested] += 1;
SetPlayerFree(suspect,playerid, "was arrested");
WantedPoints[suspect] = 0;
PlayerInfo[suspect][pWantedLevel] = 0;
SetPlayerToTeamColor(suspect);
SetPlayerWantedLevel(suspect, 0);
WantLawyer[suspect] = 1;
TogglePlayerControllable(suspect, 1);
ClearAnimations(suspect);
PlayerCuffed[suspect] = 0;
DeletePVar(suspect, "PlayerCuffed");
PlayerCuffedTime[suspect] = 0;
PlayerInfo[suspect][pVW] = 133337;
SetPlayerVirtualWorld(suspect, 133337);
SetPlayerInterior(suspect, 10);
SetPlayerSpecialAction(giveplayerid,SPECIAL_ACTION_NONE);
RemovePlayerAttachedObject(giveplayerid,0);
}
else if(IsPlayerInRangeOfPoint(playerid, 3.0,611.96, -587.25, 17.22))
{
//format(string, sizeof(string), "<< Officer %s arrested suspect %s >>", sendername, giveplayer);
//OOCNews(COLOR_LIGHTRED, string);
SetPlayerInterior(suspect, 5);
SetPlayerPos(suspect,319.17, 312.13, 999.14);
if(PlayerInfo[suspect][pDonateRank] >= 2)
{
PlayerInfo[suspect][pJailTime] = ((time*60)*75)/100;
}
else
{
PlayerInfo[suspect][pJailTime] = time * 60;
}
SetPVarInt(suspect, "IsFrozen", 0);
//Frozen[suspect] = 0;
PlayerInfo[suspect][pJailed] = 5;
PhoneOnline[suspect] = 1;
PlayerInfo[suspect][pArrested] += 1;
SetPlayerFree(suspect,playerid, "was arrested");
WantedPoints[suspect] = 0;
PlayerInfo[suspect][pWantedLevel] = 0;
SetPlayerToTeamColor(suspect);
SetPlayerWantedLevel(suspect, 0);
WantLawyer[suspect] = 1;
TogglePlayerControllable(suspect, 1);
ClearAnimations(suspect);
PlayerCuffed[suspect] = 0;
SetPVarInt(suspect, "PlayerCuffed", 0);
PlayerCuffedTime[suspect] = 0;
PlayerInfo[suspect][pVW] = 0;
SetPlayerVirtualWorld(suspect, 0);
SetPlayerSpecialAction(giveplayerid,SPECIAL_ACTION_NONE);
RemovePlayerAttachedObject(giveplayerid,0);
}
else if(IsPlayerInRangeOfPoint(playerid, 3.0,2334.65, 566.84, 7.78) || IsPlayerInRangeOfPoint(playerid, 3.0,2182.20, 530.32, 1.19))
{
//format(string, sizeof(string), "<< Coast Guardsman %s arrested suspect %s >>", sendername, giveplayer);
//OOCNews(COLOR_LIGHTRED, string);
SetPlayerInterior(suspect, 5);
SetPlayerPos(suspect,319.17, 312.13, 999.14);
if(PlayerInfo[suspect][pDonateRank] >= 2)
{
PlayerInfo[suspect][pJailTime] = ((time*60)*75)/100;
}
else
{
PlayerInfo[suspect][pJailTime] = time * 60;
}
SetPVarInt(suspect, "IsFrozen", 0);
//Frozen[suspect] = 0;
PlayerInfo[suspect][pJailed] = 5;
PhoneOnline[suspect] = 1;
PlayerInfo[suspect][pArrested] += 1;
SetPlayerFree(suspect,playerid, "was arrested");
WantedPoints[suspect] = 0;
PlayerInfo[suspect][pWantedLevel] = 0;
SetPlayerToTeamColor(suspect);
SetPlayerWantedLevel(suspect, 0);
WantLawyer[suspect] = 1;
TogglePlayerControllable(suspect, 1);
ClearAnimations(suspect);
PlayerCuffed[suspect] = 0;
SetPVarInt(suspect, "PlayerCuffed", 0);
PlayerCuffedTime[suspect] = 0;
PlayerInfo[suspect][pVW] = 0;
SetPlayerVirtualWorld(suspect, 0);
SetPlayerSpecialAction(giveplayerid,SPECIAL_ACTION_NONE);
RemovePlayerAttachedObject(giveplayerid,0);
}
if(bail == 1)
{
JailPrice[suspect] = bailprice;
format(string, sizeof(string), "You are jailed for %d seconds. Bail: $%d", PlayerInfo[suspect][pJailTime], JailPrice[suspect]);
SendClientMessageEx(suspect, COLOR_LIGHTBLUE, string);
}
else
{
JailPrice[suspect] = 0;
format(string, sizeof(string), "You are jailed for %d seconds. Bail: Unable", PlayerInfo[suspect][pJailTime]);
SendClientMessageEx(suspect, COLOR_LIGHTBLUE, string);
}
}//distance
}//not connected
else
{
SendClientMessageEx(playerid, COLOR_GREY, " No-one close enough to arrest.");
return 1;
}
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, " You are not a Cop / FBI / Coastguard!");
return 1;
}
return 1;
}