What's wrong?
#4

Okay, the problem here is with your logic. When you loop through the players, you check if the person is a cop and show all the wanted players inside the loop. Since looping starts from ID 0, this will only pick up the wanted players before the ID of a given police officer.

You can do this properly by first looping through the players and getting the wanted players, then loop through the players again to display the list of wanted players to the police officers.

pawn Код:
new szInfo[74 + 1], iPlayersWanted = 0;

foreach(new i: Player) {
    if(GetPlayerWantedLevel(i) > 0) {
        iPlayersWanted++;
    }
}

foreach(new i: Player {
    if (iClass[i] == ClassPolice)
    {
        format(szInfo, 75, "~b~%d ~w~ieskomu zaideju. Norint suiimti/duoti bauda, spauskite ~r~MMB", iPlayersWanted);
        TextDrawSetString(TD_JobInfo[i], szInfo);
    }
}
PS: There are probably more efficient ways of doing this, but this is the easiest way to explain what you are doing wrong.
Reply


Messages In This Thread
What's wrong? - by BaubaS - 15.02.2012, 22:06
Re: What's wrong? - by N0FeaR - 15.02.2012, 22:19
Re: What's wrong? - by BaubaS - 16.02.2012, 09:20
Re: What's wrong? - by JamesC - 16.02.2012, 09:29
Re: What's wrong? - by BaubaS - 16.02.2012, 16:30
Re: What's wrong? - by BaubaS - 16.02.2012, 19:54
Re: What's wrong? - by JamesC - 17.02.2012, 12:45

Forum Jump:


Users browsing this thread: 2 Guest(s)