13.07.2013, 15:04
Hey guys. i have a problem about /arrest and /detain.
First is /arrest.
My /arrest doesn't work even my suspect is cuffed+detain in my cruiser.
Here's my /arrest script:
And second is /detain
Yea it works i can detain my cuffed prisoner in my car but he can get out of the car. why is that?
Heres my /detain script:
If you guys can help me. i will be thank-full.
Thank you in advance.
First is /arrest.
My /arrest doesn't work even my suspect is cuffed+detain in my cruiser.
Here's my /arrest script:
pawn Код:
CMD:arrest(playerid, params[])
{
new playerb, time, string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!IsACop(playerid) && !IsFBI(playerid) && !IsNG(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not a LEO.");
if(!PlayerInfo[playerid][pFacDuty]) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
if(!IsPlayerInRangeOfPoint(playerid, 2, ap[0], ap[1], ap[2])) return SendClientMessage(playerid, COLOR_GREY, "You are not near the arrest point.");
if(sscanf(params, "uis[64]", playerb, time, params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /arrest [playerid] [minutes]");
if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
if(!PlayerInfo[playerb][pWanted]) return SendClientMessage(playerid, COLOR_GREY, "Player is not wanted.");
if(IsACop(playerb) && IsFBI(playerb) && IsNG(playerb)) return SendClientMessage(playerid, COLOR_GREY, "You can't arrest an LSPD Officer.");
if(!IsPlayerNearPlayer(playerid, playerb, 2)) return SendClientMessage(playerid, COLOR_GREY, "You are too far away from that player.");
format(string, sizeof(string), "Local Prison: %s has been arrested by %s.", RPN(playerb), RPN(playerid));
foreach(Player, i)
{
if(IsACop(i) || IsFBI(i) || IsNG(i))
{
SendClientMessage(i, COLOR_BLUE, string);
}
}
SetPlayerColor(playerb, TRANSPARENT_ORANGE);
PlayerInfo[playerb][pArrested] ++;
PlayerInfo[playerb][pPrison] = 2;
PlayerInfo[playerb][pPrisonTime] = time*60;
ClearDodWantedLevels(playerb);
SetPlayerInterior(playerb, 0);
SetPlayerVirtualWorld(playerb, 0);
new RandomCell = random(sizeof(RandomPrison));
SetPlayerFacingAngle(playerb, RandomPrison[RandomCell][3]);
TogglePlayerControllable(playerb, 0);
SetTimerEx("EnterExitTimer", 5000, false, "i", playerb);
SetPlayerPos(playerb, RandomPrison[RandomCell][0], RandomPrison[RandomCell][1], RandomPrison[RandomCell][2]);
SetCameraBehindPlayer(playerb);
format(string, sizeof(string), " You have been arrested by an officer for %d minutes (%d seconds)", PlayerInfo[playerb][pPrisonTime]/60, PlayerInfo[playerb][pPrisonTime]);
SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
RemovePlayerAttachedObject(playerb, 0);
SetPlayerSpecialAction(playerb, SPECIAL_ACTION_NONE);
// Clearing robbery
if(BankRobber[playerb])
{
new Rob = BankRobber[playerb]-1;
DisablePlayerCheckpoint(playerb);
BankRobbersCount --;
format(BankRobbers[Rob], MAX_PLAYER_NAME, "");
DeliverMoney[playerb] = 0;
//
foreach(Player, i)
{
if(BankRobber[i] || PlayerInfo[i][pFac] == 1)
{
if(Rob == 0) TextDrawHideForPlayer(i, Textdraw1);
else if(Rob == 1) TextDrawHideForPlayer(i, Textdraw2);
else if(Rob == 2) TextDrawHideForPlayer(i, Textdraw3);
else if(Rob == 3) TextDrawHideForPlayer(i, Textdraw4);
else if(Rob == 4) TextDrawHideForPlayer(i, Textdraw5);
}
}
format(string, sizeof(string), "** %s has been arrested and has failed the robbery. **", RPN(playerb));
SendRobberyMessage(COLOR_LIGHTRED, string);
SendCopMessage(COLOR_LIGHTRED, string);
BankRobber[playerb] = 0;
if(BankRobbersCount == 0)
{
TextDrawHideForAll(Textdraw0);
TextDrawHideForAll(Textdraw1);
TextDrawHideForAll(Textdraw2);
TextDrawHideForAll(Textdraw3);
TextDrawHideForAll(Textdraw4);
TextDrawHideForAll(Textdraw5);
// BankRobbery = 0;
RobberyStarted = 0;
TotalRobbers = 0;
new copsonline;
foreach(Player, i)
{
if(IsACop(i) || IsFBI(i) || IsNG(i)) copsonline++;
}
foreach(Player, i)
{
if(IsACop(i) || IsFBI(i) || IsNG(i))
{
new Saved = (TotalRobbers*50000-(TotalStolen*50000));
format(string, sizeof(string), "** You have received your cut from the saved money. ($%d)", Saved/copsonline);
SendClientMessage(i, COLOR_LIME, string);
}
}
}
}
return 1;
}
Yea it works i can detain my cuffed prisoner in my car but he can get out of the car. why is that?
Heres my /detain script:
pawn Код:
CMD:detain(playerid, params[])
{
new playerb, seatid, string[128], vehicle;
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!IsACop(playerid) && !IsFBI(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an LSPD Oficer/FBI Agent.");
if(sscanf(params, "ui", playerb, seatid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /detain [playerid] [seatid]");
if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
if(!IsPlayerNearPlayer(playerid, playerb, 2)) return SendClientMessage(playerid, COLOR_GREY, "You can't detain someone from this disatance.");
if(!IsPlayerCuffed(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Player is not cuffed.");
vehicle = GetPlayerVehicleID(playerid);
if(!IsCruiser(vehicle)) return SendClientMessage(playerid, COLOR_GREY, "You need an LSPD crusier to detain someone in.");
if(seatid < 2 || seatid > 3) return SendClientMessage(playerid, COLOR_GREY, "You can only detain people in seats 2 and 3.");
PutPlayerInVehicle(playerb, vehicle, seatid);
format(string, sizeof(string), "* %s grabs %s from their cuffs and throws him inside the LSPD cruiser.", RPN(playerid), RPN(playerb));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
return 1;
}
Thank you in advance.