having warning trouble with a command chain [FIXED]
#1

here is my trouble,

when a police officer uses /wanted it shows everyone that is wanted over 1* and when a bounty hunter dose /wanted it only will show 5-6* wanted peaple BUT!

here is how it reacts when a police officer that is on dity dose /wanted it works fine and when a civ. dose /wanted it spams there screen with no criminals not sure what ive done wrong here is where the warning/error is located (// WARNING!)

i believe there is something looping that shouldn't be but cant seam to find out where it is looping/skipping
pawn Код:
if(strcmp(cmd, "/wanted", true) == 0)
    {
      if(IsPlayerConnected(playerid))
        {
            if((PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 1||PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 2))
            {
              if(CopOnDuty[playerid])
              {
                new count = 0;
                    SendClientMessage(playerid, COLOR_LIGHTGREEN, "-----------[Wanted Suspects]-----------");
                  for(new i=0; i < MAX_PLAYERS; i++)
                    {
                        if(IsPlayerConnected(i))
                        {
                          if(WantedLevel[i] >= 1)
                          {
                            format(string, sizeof(string), "[WANTED:] %s (ID:%d) - Wanted Level: %d.",GetPlayerNameEx(i),i,WantedLevel[i]);
                                SendClientMessage(playerid,COLOR_WHITE,string);
                                count++;
                            }
                        }
                    }
                    if(count == 0)
                    {
                    SendClientMessage(playerid,COLOR_WHITE,"[INFO:] Currently no criminals wanted.");
                    }
                    SendClientMessage(playerid, COLOR_LIGHTGREEN, "------------------------------------------------");
                }
                else
                {
                  SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Your not on duty!");
                }
            }
            else if(PlayerInfo[playerid][pJob] = 7) // WARNING!
            {
                new count = 0;
                SendClientMessage(playerid, COLOR_LIGHTGREEN, "-----------[Wanted Suspects]-----------");
                for(new i=0; i < MAX_PLAYERS; i++)
                {
                    if(IsPlayerConnected(i))
                    {
                        if(WantedLevel[i] >= 5)
                        {
                            format(string, sizeof(string), "[WANTED:] %s (ID:%d) - Wanted Level: %d.",GetPlayerNameEx(i),i,WantedLevel[i]);
                            SendClientMessage(playerid,COLOR_WHITE,string);
                            count++;
                        }
                    }
                }
                if(count == 0)
                {
                    SendClientMessage(playerid,COLOR_WHITE,"[INFO:] Currently no criminals wanted.");
                }
                SendClientMessage(playerid, COLOR_LIGHTGREEN, "------------------------------------------------");
            }
            else
            {
              SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You arent a Police Officer / Bounty Hunter!");
            }
        }
        return 1;
    }
Warning Message
pawn Код:
warning 211: possibly unintended assignment
Reply
#2

pawn Код:
else if(PlayerInfo[playerid][pJob] = 7) // WARNING!
A typo with the '=', swap it to a '==' or whatever you want for that check.
Reply
#3

ahhh knew it had to be simple like that, fixed the issue thanks alot
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)