Command Problem Returning [URGENT]
#1

I got a command for most wanted players to display them in a dialog, But its saying there is no wanted players online when there is.


http://pastebin.com/AMnY4qhm


Thanks
Reply
#2

pawn Код:
if(strcmp(cmd, "/mostwanted", true) == 0 || strcmp(cmd, "/mw", true) == 0) {

  {

   new count = 0;

   if(gTeam[playerid] != TEAM_ARMY) return SendClientMessage(playerid,COLOR_RED,"You cannot use this command, You are not team army!");
}
else
{
  for(new i = 0; i < MAX_PLAYERS; i++)

   {

      if(GetPlayerWantedLevel(i) >= 8 && count <= 4)

      {

        count ++;

        new namer[30];

        new dialstring[256];

        GetPlayerName(i,namer,30);

 

        format(dialstring,sizeof(dialstring),"\nMost Wanted Player List: \n\n%s[%d]\n%s[%d]\n%s[%d]",namer,i,namer,i,namer,i);

        ShowPlayerDialog(playerid,DIALOG_PLAYER_NOTICES,0,"Los Santos C 'n' R [BMUK] (0.3)",dialstring,"Ok","Cancel");

      }

      else if (GetPlayerWantedLevel(i) >= 0 && count <= 0)

      {

        SendClientMessage(playerid,COLOR_RED,"No most wanted players online!");

        }


      }

   }

 

  return 1;
  }
Reply
#3

It spams no wanted players online.
Reply
#4

Код:
if(strcmp(cmd, "/mostwanted", true) == 0 || strcmp(cmd, "/mw", true) == 0)
{
  new count = 0;
  if(gTeam[playerid] != TEAM_ARMY){return SendClientMessage(playerid,COLOR_RED,"You cannot use this command, You are not team army!");
  }else{
	  for(new i = 0; i < MAX_PLAYERS; i++)
	  {
	    if(GetPlayerWantedLevel(i) >= 8 && count <= 4)
      {
        count ++;
        new namer[30];
        new dialstring[256];
        GetPlayerName(i,namer,30);
        format(dialstring,sizeof(dialstring),"\nMost Wanted Player List: \n\n%s[%d]\n%s[%d]\n%s[%d]",namer,i,namer,i,namer,i);
        ShowPlayerDialog(playerid,DIALOG_PLAYER_NOTICES,0,"Los Santos C 'n' R [BMUK] (0.3)",dialstring,"Ok","Cancel");
      }
    }
	  if (count==0)
    {
    		SendClientMessage(playerid,COLOR_RED,"No most wanted players online!");
    }
  }
  return 1;
}
As you noticed, code tags do not support indenting properly. re-indent the above code.
PS: haven't tested
Reply
#5

None of the codes above will show you top 3 most wanted players. This will:
pawn Код:
if(strcmp(cmd, "/mostwanted", true) == 0 || strcmp(cmd, "/mw", true) == 0)
{
  if(gTeam[playerid] != TEAM_ARMY) return SendClientMessage(playerid, COLOR_RED, "You cannot use this command, you are not team army!");
  new wanted[10] = { INVALID_PLAYER_ID, ... }, level;
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    if(IsPlayerConnected(i))
    {
      level = GetPlayerWantedLevel(i);
      if(level > 7)
      {
        for(new j = 0; j < sizeof(wanted); j++)
        {
          if(level > GetPlayerWantedLevel(wanted[j]))
          {
            if(j != sizeof(wanted)-1)
            {
              for(new l = sizeof(wanted)-1; l > j; l--)
              {
                wanted[l] = wanted[l-1];
              }
            }
            wanted[j] = i;
            break;
          }
        }
      }
    }
  }
  if(wanted[0] == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "No most wanted players online!");
  new str[256], tmp[64], name[MAX_PLAYER_NAME];
  for(new i = sizeof(wanted)-1; i != -1; i--)
  {
    if(wanted[i] != INVALID_PLAYER_ID)
    {
      GetPlayerName(wanted[i], name, MAX_PLAYER_NAME);
      format(tmp, sizeof(tmp), "\n%s[%d] wanted level: %d", name, wanted[i], GetPlayerWantedLevel(wanted[i]));
      strins(str, tmp, 0);
    }
  }
  strins(str, "\nMost Wanted Player List: \n", 0);
  ShowPlayerDialog(playerid, DIALOG_PLAYER_NOTICES, 0, "Los Santos C 'n' R [BMUK] (0.3)", str, "Ok", "Cancel");
  return 1;
}
It will show you the most wanted players(max. 10 players) with wanted level higher than 7.. It should work.
Reply
#6

What I must change in this Mастерминд? i want to get score but isnt working if i have - ;x must be >= 0 and i want minus too
Reply
#7

Quote:
Originally Posted by Jefff
What I must change in this Mастерминд? i want to get score but isnt working if i have - ;x must be >= 0 and i want minus too
You need to remove if(level > 7) If you want negative score too.. :3
Reply
#8

Then i have unknown command but fixed myself
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)