SA-MP Forums Archive
having warning trouble with a command chain [FIXED] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: having warning trouble with a command chain [FIXED] (/showthread.php?tid=74546)



having warning trouble with a command chain [FIXED] - [LCG]TANKER - 23.04.2009

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



Re: having warning trouble with a command chain - Donny_k - 23.04.2009

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


Re: having warning trouble with a command chain - [LCG]TANKER - 23.04.2009

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