Author Topic: /c wanted bug  (Read 2474 times)

0 Members and 2 Guests are viewing this topic.

Offline saberman

  • Street Thug
  • *
  • Posts: 22
    • View Profile
/c wanted bug
« on: May 27, 2011, 05:16:30 pm »
[pawn]   else if(strcmp(cmd, "sus", true) == 0)
   {
      new tmp2[256]; new fbil[126]; fbil = dini_Get(file, "FBI"); new plr; plr = FindPlayerIDFromString(tmp);
      tmp = strtok(cmdtext, idx), tmp2 = strrest(cmdtext, idx);
      if(PlayerInfo[playerid][Cop] == 0 && strval(fbil) < 2) SendClientMessage(playerid, RED, "Only FBI Agent+ or a police officer can suspect!");
      else if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, RED, "You have to be logged in first!");
      else if(!strlen(tmp2)) SendClientMessage(playerid, RED, "USAGE: /c sus(pect) [id/name] [reason]");
      else if(!IsPlayerConnected(plr)) SendClientMessage(playerid, RED, "Target ID not found");
      else
      {
        format(szMsg, 256, "%s has been suspected by %s for %s", gPlayers[plr], gPlayers[playerid], tmp2);
        SendClientMessageToAll(GREEN, szMsg);
        PlayerInfo[plr][Wanted] = 1;
      }
      return 1;
   }
    else if (strcmp(cmd, "wanted", true) == 0)
   {
       new Count,i,name[24],string[256];
       for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[playerid][Wanted] > 0) Count++;
       if(!Count) return SendClientMessageToAll(BLUE,"No Wanted Players");
       if(Count == 1)
      {
          for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[playerid][Wanted] > 0) break;
          GetPlayerName(i,name,24);
          format(string,256,"Wanted Players: %s[%d]",name,PlayerInfo[Wanted]);
          return SendClientMessageToAll(BLUE,string);
       }
       if(Count >= 1)
      {
          new bool:First = false;
          for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[playerid][Wanted] > 0) {
          GetPlayerName(i,name,24);
          if(!First)
        {
             format(string,256,"Wanted Players: %s[%d],",name,PlayerInfo[Wanted]);
             First = true;
          }
          else format(string,256,"%s, %s[%d]",string,name,PlayerInfo[Wanted]);
       }
       return SendClientMessageToAll(BLUE,string);
    }
    return 1;
   }[/pawn]
Server crashes when I use the /c wanted command.

Offline stormeus

  • VC:MP Developer
  • VC:MP Veteran
  • *
  • Posts: 1122
    • View Profile
Re: /c wanted bug
« Reply #1 on: May 27, 2011, 10:28:05 pm »
[pawn]
       for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[playerid][Wanted] > 0) Count++;
[/pawn]

I think this is what you meant:
[pawn]
PlayerInfo[Wanted] > 0
[/pawn]

See if this fixes anything.
Do not PM me for support.




Offline saberman

  • Street Thug
  • *
  • Posts: 22
    • View Profile
Re: /c wanted bug
« Reply #2 on: May 28, 2011, 09:22:36 am »
Thanks for the help!