Problem with command /arrest
#1

Hello everybody, how are you ? I Have got a problem with command /arrest : When i try /arrest of suspect player, and Command send me In Jail, and just said that Player who i suspect is in arrest. And after 5 minutes he leave from arrest but he isnt in arrest. What's the wrong ? This is my code

pawn Код:
if(strcmp(cmd, "/arrest", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pMember] == TEAM_LSPD)
            {

                if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == TEAM_LSPD)
                {
                    SendClientMessage(playerid, COLOR_GREY, "   You're not on duty!");
                    return 1;
                }
                if(!PlayerToPoint(6.0, playerid, 322.9259,311.8636,999.1484)) // Point for type /arrest
                {// Jail spot
                    SendClientMessage(playerid, COLOR_GREY, "   You're not to arrest point!");
                    return 1;
                }
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "Използвай: /arrest [пари(да му вземе)] [Време (минути)] [Гаранция (0=не 1=да)] [цена за гаранцията]");
                    return 1;
                }
                moneys = strval(tmp);
                if(moneys < 100 || moneys > 100000) { SendClientMessage(playerid, COLOR_GREY, "   Неможеш да му земеш по малко от 100$ или повече от 100,000$ !"); return 1; }
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "Използвай: /arrest [пари(да му вземе)] [Време (минути)] [Гаранция (0=не 1=да)] [цена за гаранцията]");
                    return 1;
                }
                new time = strval(tmp);
                if(time < 1 || time > 60) { SendClientMessage(playerid, COLOR_GREY, "   Времето за арест неможе да бъде по-малко от 1 минута или повече от 60 минути!"); return 1; }
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "Use: /arrest [Money)] [Time (minutes)] [Bail (0=no 1=yes)] [Cost bail]");
                    return 1;
                }
                new bail = strval(tmp);
                if(bail < 0 || bail > 1) { SendClientMessage(playerid, COLOR_GREY, "   Гаранцията може да бъде само с числа: 1(да) и 0(не) !"); return 1; }
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "Use: /arrest [Money)] [Time (minutes)] [Bail (0=no 1=yes)] [Cost bail]");
                    return 1;
                }
                new bailprice = strval(tmp);
                if(bailprice < 1000 || bailprice > 500000) { SendClientMessage(playerid, COLOR_GREY, "   Bail can be 1000-500 000$!"); return 1; }
                new suspect = GetClosestPlayer(playerid);
                if(IsPlayerConnected(suspect))
                {
                    if(GetDistanceBetweenPlayers(playerid,suspect) < 5)
                    {
                        if(WantedLevel[suspect] < 1)
                        {
                            SendClientMessage(playerid, COLOR_GREY, "   This player isnt suspect!");
                            return 1;
                        }
                        format(string, sizeof(string), "* You arrest %s !", PlayerName(suspect));
                        SendClientMessage(playerid, COLOR_BLUE, string);
                        SetPlayerPos(playerid, 3439.7053,-2089.6165,35.7855);//we're done, you can test Okay bro Thanks very much i love you :*
                        GivePlayerMoney(suspect, -moneys);
                        format(string, sizeof(string), "arrested by %s ~n~    for $%d", PlayerName(playerid), moneys);
                        GameTextForPlayer(suspect, string, 5000, 5);
                        ResetPlayerWeapons(suspect);
                        new ranktext[256];
                        switch(PlayerInfo[playerid][pRank])
                        {
                            case 1: format(ranktext, sizeof(ranktext), "%s", TeamInfo[PlayerInfo[playerid][pMember]][fRank1]);
                            case 2: format(ranktext, sizeof(ranktext), "%s", TeamInfo[PlayerInfo[playerid][pMember]][fRank2]);
                            case 3: format(ranktext, sizeof(ranktext), "%s", TeamInfo[PlayerInfo[playerid][pMember]][fRank3]);
                            case 4: format(ranktext, sizeof(ranktext), "%s", TeamInfo[PlayerInfo[playerid][pMember]][fRank4]);
                            case 5: format(ranktext, sizeof(ranktext), "%s", TeamInfo[PlayerInfo[playerid][pMember]][fRank5]);
                            case 6: format(ranktext, sizeof(ranktext), "%s", TeamInfo[PlayerInfo[playerid][pMember]][fRank6]);
                        }
                        if(PlayerInfo[playerid][pMember]== TEAM_LSPD)
                        {
                            format(string, sizeof(string), "%s Arrest suspect%s for %d minutes", PlayerName(playerid), PlayerName(suspect), time);
                            SendClientMessageToAll(COLOR_RED, string);
                        }
                        if(bail == 1)
                        {
                            JailPrice[suspect] = bailprice;
                            format(string, sizeof(string), "You're jailed for %d seconds..   Bail: $%d", PlayerInfo[suspect][pJailTime], JailPrice[suspect]);
                            SendClientMessage(suspect, COLOR_BLUE, string);
                        }
                        else
                        {
                            JailPrice[suspect] = 0;
                            format(string, sizeof(string), "You're jailed for %d seconds.   Bail: No", PlayerInfo[suspect][pJailTime]);
                            SendClientMessage(suspect, COLOR_BLUE, string);
                        }
                                        }//distance
                }//not connected
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "   Suspect isnt near you.");
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   You are not from Red County Police!");
                return 1;
            }
        }//not connected
        return 1;
    }
Reply
#2

i didn't used this kind of stuff but the below code may help you

http://pastebin.com/f15cd2ba6
Reply
#3

Bro i am new i dont know what to do ..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)