Problem about /arrest and /detain!
#1

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:
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;
}
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:
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;
}
If you guys can help me. i will be thank-full.
Thank you in advance.
Reply
#2

Bump
Reply
#3

Bump
Reply
#4

what is problem again ?!
Reply
#5

Read the whole thing sir....

arrest doesent work..

detain works but they can get out of thecar.
Reply
#6

You can add TogglePlayerControllable(playerb, 0); under /detain
And about /arrest you must give your suspect a wanted level first, if you want to avoid this remove the pWanted line.
Reply
#7

In your detain command add TogglePlayerControllable(playerb,0); . That should stop them from getting out of the car.

As for your arrest command you should provide a little more information. Does any part of the command work? Does it send the proper messages out? Does it say the player got arrested but doesn't teleport him?
Reply
#8

No it doesent say anything when i use /arrest it just shows you how to use it even i typed the ID and TIME
Reply
#9

well /detain is supposed to work like that, your suspect is cuffed, cant move from car, and when you come to arrest position, you can just send him to jail. I will try to fix /arrest.
EDIT: try to change this line in /arrest:
Код:
     if(sscanf(params, "uis[64]", playerb, time, params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /arrest [playerid] [minutes]");
to this:
Код:
     if(sscanf(params, "ui", playerb, time)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /arrest [playerid] [minutes]");
Reply
#10

Quote:
Originally Posted by dominik523
Посмотреть сообщение
well /detain is supposed to work like that, your suspect is cuffed, cant move from car, and when you come to arrest position, you can just send him to jail. I will try to fix /arrest.
EDIT: try to change this line in /arrest:
Код:
     if(sscanf(params, "uis[64]", playerb, time, params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /arrest [playerid] [minutes]");
to this:
Код:
     if(sscanf(params, "ui", playerb, time)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /arrest [playerid] [minutes]");
Thanks my /arrest and /detain is now fixed. thank you for all of your help. all of you guys tried to help!
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)