bug wanted
#1

The player give double wanted And i give him wanted when is in the jail.
I want player give corect wanted he have 1 wanted i give him 1 wanted = 2 wanted no 4 and i want dont give him wanted when is in the jail
Sorry for my bag english.

Код:
if(strcmp(cmd, "/suspect", true) == 0 || strcmp(cmd, "/su", true) == 0)
{
              if(IsPlayerConnected(playerid))
        {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                        SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/su)spect [playerid/PartOfName] [WantedLevel] [crime discription]");
                        return 1;
                }
                giveplayerid = ReturnUser(tmp);
                if (IsACop(playerid))
                {
                        if(IsPlayerConnected(giveplayerid))
                        {
                                if(giveplayerid != INVALID_PLAYER_ID)
                                {
                                        if(!IsACop(giveplayerid))
                                        {
                                                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                                                GetPlayerName(playerid, sendername, sizeof(sendername));
                                                new length = strlen(cmdtext);
                                                while ((idx < length) && (cmdtext[idx] <= ' '))
                                                {
                                                        idx++;
                                                }
                                                new offset = idx;
                                                new result[64];
                                                while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                                                {
                                                        result[idx - offset] = cmdtext[idx];
                                                        idx++;
                                                }
                                                result[idx - offset] = EOS;
                                                if(!strlen(result))
                                                {
                                                        SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/su)spect [playerid/PartOfName] [WantedLevel] [crime text]");
                                                        return 1;
                                                }
                                                WantedPoints[giveplayerid] += 2;
                                                SetPlayerCriminal(giveplayerid,playerid, result);
                                                return 1;
                                        }
                                        else
                                        {
                                                SendClientMessage(playerid, COLOR_GRAD2, "   Nu poti suspecta un politist !");
                                        }
                                }
                        }
                        else
                        {
                                format(string, sizeof(string), "   %d is not an active player.", giveplayerid);
                                SendClientMessage(playerid, COLOR_GRAD1, string);
                                return 1;
                        }
                }
                else
                {
                        SendClientMessage(playerid, COLOR_GRAD2, "   Nu faci parte dintr-un Departament");
                }
        }
        return 1;
}
Reply
#2

WantedPoints[giveplayerid] += 2;
change to
WantedPoints[giveplayerid] ++;
Reply
#3

I resolved, but when I give someone wanted the stars disappear in an instant



Код HTML:
if(strcmp(cmd, "/suspect", true) == 0 || strcmp(cmd, "/su", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/su)spect [playerid/PartOfName] [WantedLevel] [crime discription]");
            new giveplayerid;
            new money;
            giveplayerid = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            money = strval(tmp);
            if (IsACop(playerid))
            {
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        new length = strlen(cmdtext);
                        while ((idx < length) && (cmdtext[idx] <= ' '))
                        {
                            idx++;
                        }
                        new offset = idx;
                        new result[64];
                        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                        {
                            result[idx - offset] = cmdtext[idx];
                            idx++;
                        }
                        result[idx - offset] = EOS;
                        result[0] = toupper(result[0]);
                        if(!strlen(result)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/su)spect [playerid/PartOfName] [WantedLevel] [crime discription]");
                        if (gTeam[giveplayerid] == 2 || IsACop(giveplayerid)) return SendClientMessage(playerid, COLOR_GRAD2, " Nu poti da wanted unui Politist");
                        if(PlayerInfo[giveplayerid][pJailed] == 1 || PlayerInfo[giveplayerid][pJailed] == 2) return SendClientMessage(playerid, COLOR_WHITE, "{33CCFF}ServeR: Nu poti da Wanted unui player in Inchisoare!");
                        if(money > 10) return SendClientMessage(playerid, COLOR_GRAD2, "Wanted maxim este 10!");
                        if(money == 0) return SendClientMessage(playerid, COLOR_GRAD2, "Wanted minim este 0!");
                        if(PlayerInfo[giveplayerid][pWanted] > 9) return SendClientMessage(playerid, COLOR_GRAD2, "Acest player are deja wantedul maxim! (Wanted 10)");
                        format(string, sizeof(string), "Acest jucator are deja wanted level %d", PlayerInfo[giveplayerid][pWanted]);
                        if(PlayerInfo[giveplayerid][pWanted] + money > 10) return SendClientMessage(playerid, COLOR_GRAD2, string);
                        PlayerInfo[giveplayerid][pWanted] += money;
                   new wl = PlayerInfo[giveplayerid][pWanted];
SetPlayerWantedLevel(giveplayerid, wl);
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        format(string, sizeof(string), "Ai comis o crima ( %s ) [+%d],Raportat de: %s",result,money,sendername);
                        SendClientMessage(giveplayerid, COLOR_GRAD2, string);
                        for(new i = 0; i < MAX_PLAYERS; i++)
                        {
                            if(IsPlayerConnected(i))
                            {
                                if(PlayerInfo[i][pMember] == 1 || PlayerInfo[i][pLeader] == 1 || PlayerInfo[i][pMember] == 2 || PlayerInfo[i][pLeader] == 2 || PlayerInfo[i][pMember] == 3 || PlayerInfo[i][pLeader] == 3)
                                {
                                    format(string, sizeof(string), "HQ: Tuate unitatile APB: Reporter: %s.",sendername);
                                    SendClientMessage(i, 0x0000C1FF, string);
                                    format(string, sizeof(string), "HQ: Crima: %s[+%d], Suspect: %s. ",result,money,giveplayer);
                                    SendClientMessage(i, 0x0000C1FF, string);
                                }
                            }
                        }
                    }
                }
            } else return SendClientMessage(playerid, COLOR_GRAD2, "Nu esti Politist!");
        }
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: